The ULTIMATE Guide to Room Migration in Android (Database Migration Tutorial)

  Рет қаралды 24,584

Philipp Lackner

Philipp Lackner

Күн бұрын

Whenever you change your database schema, you will need to provide a migration, so Room knows what to do with existing data. In this video I will show you how that works.
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/...
💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
pl-coding.com/...
Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
pl-coding.com/...
Join this channel to get access to perks:
/ @philipplackner
Get the source code for this video here:
github.com/phi...
Join my Discord server:
/ discord
Regular programming advice on my Instagram page: / _philipplackner_
Checkout my GitHub: github.com/phi...
You like my free content? Here you can buy me a coffee:
www.buymeacoff...

Пікірлер: 79
@yasserakbbach708
@yasserakbbach708 2 жыл бұрын
This man is doing Google a huge favor 😂😂
@PhilippLackner
@PhilippLackner 2 жыл бұрын
😂 💪
@tch.777
@tch.777 2 жыл бұрын
Every time I encounter a problem, you just release a video of a solution, there is no one like you!! I'm a big fan!! 🤗
@PhilippLackner
@PhilippLackner 2 жыл бұрын
❤️
@sijanneupane
@sijanneupane 2 жыл бұрын
guide that nobody asked for but everyone needed!
@hiteshchalise3988
@hiteshchalise3988 Жыл бұрын
Room migration blog by Florina was excellent, but glancing at the Migration Testing blog, it looked scary to me, until I saw this video. Turns out it wasn't scary at all and was very straight forward. Thank you for this video. 🙂
@swaminathbera6407
@swaminathbera6407 10 ай бұрын
yes the blog is amazing and well-written. Philipp explains easily.
@xD-saleem
@xD-saleem 2 жыл бұрын
I remember when u were 1k subs. We talked about brexit that it'll wont seperate us. now you have 82k + subs. Keep it going bro.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thanks for staying that long!
@HaSeebpjr01
@HaSeebpjr01 4 ай бұрын
everytime i stuck on something for long time this man saves me::: thanks alot
@emirhanozer
@emirhanozer 2 жыл бұрын
I just changed the Device from asio to SPDIF-out (soft blaster z) TNice tutorials improved the soft quality dramatically. I tNice tutorialnk tNice tutorials did the trick!
@tinoutech5016
@tinoutech5016 Жыл бұрын
I love your ULTIMATE guides, thank you very much.
@annguyenhoang3589
@annguyenhoang3589 2 жыл бұрын
I wait too long for this. Love your content
@behnawm
@behnawm 2 жыл бұрын
Thx for another great video Philipp! A quick short video about Moshi would be great. (also a long one can be great too cause it has too many features!)
@osisuper98
@osisuper98 2 жыл бұрын
This feels so good. Thank you Philipp.
@hossamqandel5638
@hossamqandel5638 2 жыл бұрын
Thanks Philipp for this useful content and for simple explaining
@samsammaniamantap
@samsammaniamantap Жыл бұрын
Now I know why my migration with a new table didn't work well. Thanks Phil
@mahdiporkar236
@mahdiporkar236 4 ай бұрын
Great job philipp!
@duhankazanci
@duhankazanci 5 ай бұрын
When using the Automigration feature, I often mess up my databases in a way, where my code can't comprehend the new data and crashes when fetching the Rows from the table. Until they make it even easier to migrate, I will continue modifying my tables manually with DB Browser :D
@Daaaaaaavid
@Daaaaaaavid Жыл бұрын
It would be better to use the extension function ".use{}" instead of "apply" at 29:31
@Guilo583
@Guilo583 Жыл бұрын
Thanks a lot. this is exactly what I was looking for
@neronguyenvn
@neronguyenvn Жыл бұрын
You are saving my life ! Thanks !!
@vengateshm2122
@vengateshm2122 2 жыл бұрын
Terrific explanation. Thank you.
@pmockevicius
@pmockevicius 3 ай бұрын
Great video as always Phil. I dont know if its because video was created a year ago from today and things changed since then but at this moment room automigration supports adding a new table and there is no need to do manual migration for that. Please correct me if i m wrong
@alihosseinnezhad2957
@alihosseinnezhad2957 2 жыл бұрын
Interesting like before. Thank you phillip.
@lancevincentoliveros7799
@lancevincentoliveros7799 2 жыл бұрын
now i am in a good mood
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
So much better than the Google documentation
@zoltanbalazskozma2360
@zoltanbalazskozma2360 2 жыл бұрын
Very well explained. Do you have any information about what thread are these migrations run in? I could not find any information about that.
@NiMa-1629
@NiMa-1629 2 жыл бұрын
Thanks for your great video 😊
@azamovdev
@azamovdev Жыл бұрын
Nice Work
@surendramaran
@surendramaran 2 жыл бұрын
I love your videos, you are doing such a great job dude. I've already learned a lot from you. Can anyone tell me which country he belongs to? Just curious.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Glad it helps, I'm from Germany :)
@Ibeatuphomelesspeople
@Ibeatuphomelesspeople Жыл бұрын
@@PhilippLackner how is germany? thinking about visiting eastern europe or germany
@mustafaammar551
@mustafaammar551 2 жыл бұрын
very cool video thank you bro you are the best
@achalbadgujar9519
@achalbadgujar9519 2 жыл бұрын
Much needed video
@FreedivingTrainer
@FreedivingTrainer 2 жыл бұрын
For may old project (started in 2013) I decided to leave Content Provider with SQLite cursor 👌 Maybe video about migration from content provider to room ?))
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
2013 is almost ten years ago and things are so different now!
@uafraid
@uafraid Жыл бұрын
Second migration did not really do anything, since you changed the field name to "createdAt", but column name inside @ColumnInfo was still "created". App works fine without this migration
@muzamilabdallah6768
@muzamilabdallah6768 2 жыл бұрын
it's awesome As usual
@Lethans11
@Lethans11 2 жыл бұрын
Very well explained, thanks for the video. The automigration would not work in case of having, already done, several manual migrations? or at least i would have to generate a JSON migration file for all the versions of the database.
@mayur9840
@mayur9840 11 ай бұрын
Thank you
@AzadKumar-zi5lm
@AzadKumar-zi5lm 2 жыл бұрын
the language you use very simple to understand Sir, could you make video on full guide exoplayer
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
He has a video on that, check his backlog for Spotify clone
@vbcv1
@vbcv1 6 ай бұрын
what about backing up and restoring a database (export/import) what would the best way to do that ?
@HrithikRajput-o6b
@HrithikRajput-o6b Жыл бұрын
Hey Philipp. I am from android & learning android from ur tutorial. I have question as a beginner. Actually I was making todo app entity has three fields id(int), text(string), ischecked(Boolean). My app works fine for chekbox for every task. But when I added many task It simply failed. Can u please fix this?
@ClarkWSandholtz
@ClarkWSandholtz Жыл бұрын
This is excellent. Can you do this same thing for SQLDelight for Kotlin Multiplatform?
@yoman796
@yoman796 2 жыл бұрын
So, you renamed only field in User class from create to createdAt, but you did not rename ColumnInfo from create to createdAt. I renamed ColumnInfo and this migration did not work. So this example does not work for renaming ColumnInfo
@azamovdev
@azamovdev Жыл бұрын
Dude, I have a question for you guys, if you don't mind it being silly. There are 2 applications. Is it possible to connect application 2 to the database through application 1?
@akpapps5988
@akpapps5988 2 жыл бұрын
Please do a video about how to implement refresh token in Android. I am using hilt, clean architecture,
@amruta210189
@amruta210189 Жыл бұрын
How to add new table in room database without deleting existing data please help asap
@lyawileh.a8741
@lyawileh.a8741 Жыл бұрын
When does exportedSchema set to true in the database annotation?
@Monarch_943
@Monarch_943 2 жыл бұрын
What if I want to delete the old instance of the database along with its data? It'd be a pain to migrate each change while debugging the app or internal testing it.
@andisilaban3159
@andisilaban3159 2 жыл бұрын
Hey, I just wanted to check briesofty if there is a way for to import a new soft into the program, for example softs or sotNice tutorialng that
@saraasadi3094
@saraasadi3094 7 ай бұрын
How can I mgrate a table with a relationship ???
@johnlopez9420
@johnlopez9420 2 жыл бұрын
@Philipp Lackner do you maybe have a discount code for your courses?
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
He doesn’t do discounts much anymore. Usually around the launch of a new course but it’s usually for a very limited time
@saha123456789s
@saha123456789s Жыл бұрын
hello, can you tell me, I need to make a request to the datastore after / during the migration, is it possible ?
@AmitJayant
@AmitJayant 2 жыл бұрын
What's the color scheme and font you using in Android Studio?
@mlookmero1004
@mlookmero1004 2 жыл бұрын
not wNice tutorialle quarantine but how r u doing is that hard ?
@domonk7450
@domonk7450 Жыл бұрын
what do you do if you've already been working with the db and are not on version 1, how would you generate the version 1 json file? did the file get generated because you had automigration from 1 to 2? that part is just not very clear
@ookie218
@ookie218 Жыл бұрын
I'm lost on this too
@Daaaaaaavid
@Daaaaaaavid Жыл бұрын
@Phlilipp was it an error at 29:31 to declare "var db = " if you are also doing "db =" below? Or does this have some implications and must be done?
@mryup6100
@mryup6100 11 күн бұрын
You don't need the the var db or val db at all unless you need a reference to the SupportSQLiteDatabase. Having a reference to the SupportSQLiteDatabase is useful because it allows you to execute database queries using the query method (db.query). So, just remove var db from the first call to helper, and set the second call to helper to val db. Everything will work just fine.
@ZsP3X
@ZsP3X 2 жыл бұрын
5 minutes in and tNice tutorials is 10 tis harder than garageband on my phone
@alanesaugarciagutierrez6025
@alanesaugarciagutierrez6025 2 жыл бұрын
If we try to migrate from 1 to 4 the automigrations runs 1 to 2, 2 to 3 and 3 to 4?
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
Yes
@naveensuyambu6222
@naveensuyambu6222 2 жыл бұрын
Please do the same for realm as well Philip
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
Likely won’t happen since it’s not recommend by Google anymore
@orangasli2943
@orangasli2943 2 жыл бұрын
Bro I really hope that manifest.xml in android studio will be compiled into java byte code because if not what if somebody able to convert that into JSON and change settings using JavaScript
@PhilippLackner
@PhilippLackner 2 жыл бұрын
What
@ChrisAthanas
@ChrisAthanas 2 жыл бұрын
This question needs to be rephrased and made more succinct
@gstarentertainmentedits2415
@gstarentertainmentedits2415 2 жыл бұрын
👌👌🙏🙏
@dusknews9939
@dusknews9939 Жыл бұрын
can you please start explaining instead of just writing codes,
@chani_vlogs
@chani_vlogs 2 жыл бұрын
i love u
@ProfMohamedAtef
@ProfMohamedAtef Жыл бұрын
Your effort is very nice, but why @RenameColumn, @DeleteColumn, @ RenamTable, @DeleteTable, are not working with AutoMigrationSpec ?
@Akshaykumar-xr9yj
@Akshaykumar-xr9yj 2 жыл бұрын
Thank you so much. That's what i wanted to know from long time
@nguyencodervn
@nguyencodervn 2 жыл бұрын
Thank you
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 8 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
WORLD BEST MAGIC SECRETS
00:50
MasomkaMagic
Рет қаралды 35 МЛН
Full Guide to Delegation in Kotlin  - Android Studio Tutorial
18:10
Philipp Lackner
Рет қаралды 69 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 33 М.
Room в Jetpack Compose | Android Studio + Kotlin
1:05:54
Neco Ru
Рет қаралды 10 М.
Writing My Own Database From Scratch
42:00
Tony Saro
Рет қаралды 222 М.
The Future of Database Migrations with Spectral Core team
51:03
The Ravit Show
Рет қаралды 7 М.
Postgres just got even faster
26:42
Hussein Nasser
Рет қаралды 21 М.
Room. SQLite для Android. Часть 1. [Ru, Kotlin\Android]
57:23
Mobile Developer
Рет қаралды 28 М.
SQLite Database for Android - Full Course
1:28:22
freeCodeCamp.org
Рет қаралды 249 М.
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 8 МЛН