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

Поділитися
Вставка
  • Опубліковано 13 вер 2022
  • 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/premium-courses...
    💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
    pl-coding.com/drop-table-ment...
    Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
    pl-coding.com/newsletter
    Join this channel to get access to perks:
    / @philipplackner
    Get the source code for this video here:
    github.com/philipplackner/And...
    Join my Discord server:
    / discord
    Regular programming advice on my Instagram page: / _philipplackner_
    Checkout my GitHub: github.com/philipplackner
    You like my free content? Here you can buy me a coffee:
    www.buymeacoffee.com/philippl...

КОМЕНТАРІ • 78

  • @yasserakbbach708
    @yasserakbbach708 Рік тому +42

    This man is doing Google a huge favor 😂😂

  • @tch.777
    @tch.777 Рік тому +6

    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!! 🤗

  • @HaSeebpjr01
    @HaSeebpjr01 2 місяці тому

    everytime i stuck on something for long time this man saves me::: thanks alot

  • @sijanneupane
    @sijanneupane Рік тому +1

    guide that nobody asked for but everyone needed!

  • @tinoutech5016
    @tinoutech5016 Рік тому

    I love your ULTIMATE guides, thank you very much.

  • @annguyenhoang3589
    @annguyenhoang3589 Рік тому

    I wait too long for this. Love your content

  • @hossamqandel5638
    @hossamqandel5638 Рік тому

    Thanks Philipp for this useful content and for simple explaining

  • @osisuper98
    @osisuper98 Рік тому

    This feels so good. Thank you Philipp.

  • @behnawm
    @behnawm Рік тому

    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!)

  • @mahdiporkar236
    @mahdiporkar236 2 місяці тому

    Great job philipp!

  • @vengateshm2122
    @vengateshm2122 Рік тому

    Terrific explanation. Thank you.

  • @Akshaykumar-xr9yj
    @Akshaykumar-xr9yj Рік тому

    Thank you so much. That's what i wanted to know from long time

  • @hiteshchalise3988
    @hiteshchalise3988 Рік тому +2

    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 8 місяців тому +1

      yes the blog is amazing and well-written. Philipp explains easily.

  • @Guilo583
    @Guilo583 Рік тому

    Thanks a lot. this is exactly what I was looking for

  • @zoltanbalazskozma2360
    @zoltanbalazskozma2360 Рік тому +1

    Very well explained. Do you have any information about what thread are these migrations run in? I could not find any information about that.

  • @alihosseinnezhad2957
    @alihosseinnezhad2957 Рік тому

    Interesting like before.
    Thank you phillip.

  • @neronguyenvn
    @neronguyenvn Рік тому

    You are saving my life !
    Thanks !!

  • @Lethans11
    @Lethans11 Рік тому

    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.

  • @pmockevicius
    @pmockevicius Місяць тому

    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

  • @samsammaniamantap
    @samsammaniamantap Рік тому

    Now I know why my migration with a new table didn't work well. Thanks Phil

  • @emirhanozer
    @emirhanozer Рік тому

    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!

  • @NiMa-1629
    @NiMa-1629 Рік тому

    Thanks for your great video 😊

  • @xD-saleem
    @xD-saleem Рік тому +1

    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.

  • @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?

  • @ChrisAthanas
    @ChrisAthanas Рік тому

    So much better than the Google documentation

  • @Monarch_943
    @Monarch_943 Рік тому

    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.

  • @azamovdev
    @azamovdev Рік тому

    Nice Work

  • @duhankazanci
    @duhankazanci 3 місяці тому

    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

  • @vbcv1
    @vbcv1 4 місяці тому

    what about backing up and restoring a database (export/import) what would the best way to do that ?

  • @andisilaban3159
    @andisilaban3159 Рік тому

    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

  • @ClarkWSandholtz
    @ClarkWSandholtz Рік тому

    This is excellent. Can you do this same thing for SQLDelight for Kotlin Multiplatform?

  • @mustafaammar551
    @mustafaammar551 Рік тому

    very cool video
    thank you bro
    you are the best

  • @akpapps5988
    @akpapps5988 Рік тому

    Please do a video about how to implement refresh token in Android. I am using hilt, clean architecture,

  • @muzamilabdallah6768
    @muzamilabdallah6768 Рік тому

    it's awesome As usual

  • @achalbadgujar9519
    @achalbadgujar9519 Рік тому

    Much needed video

  • @yoman796
    @yoman796 Рік тому

    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

  • @lyawileh.a8741
    @lyawileh.a8741 Рік тому

    When does exportedSchema set to true in the database annotation?

  • @AmitJayant
    @AmitJayant Рік тому

    What's the color scheme and font you using in Android Studio?

  • @user-yb6tz2vl6f
    @user-yb6tz2vl6f Рік тому

    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?

  • @saha123456789s
    @saha123456789s Рік тому

    hello, can you tell me, I need to make a request to the datastore after / during the migration, is it possible ?

  • @uafraid
    @uafraid Рік тому +1

    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

  • @lancevincentoliveros7799
    @lancevincentoliveros7799 Рік тому

    now i am in a good mood

  • @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?

  • @Daaaaaaavid
    @Daaaaaaavid Рік тому +1

    It would be better to use the extension function ".use{}" instead of "apply" at 29:31

  • @amruta210189
    @amruta210189 Рік тому

    How to add new table in room database without deleting existing data please help asap

  • @saraasadi3094
    @saraasadi3094 5 місяців тому

    How can I mgrate a table with a relationship ???

  • @mayur9840
    @mayur9840 9 місяців тому

    Thank you

  • @FreedivingTrainer
    @FreedivingTrainer Рік тому

    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 Рік тому

      2013 is almost ten years ago and things are so different now!

  • @AzadKumar-zi5lm
    @AzadKumar-zi5lm Рік тому

    the language you use very simple to understand
    Sir, could you make video on full guide exoplayer

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      He has a video on that, check his backlog for Spotify clone

  • @mlookmero1004
    @mlookmero1004 Рік тому

    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

  • @johnlopez9420
    @johnlopez9420 Рік тому

    @Philipp Lackner do you maybe have a discount code for your courses?

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      He doesn’t do discounts much anymore. Usually around the launch of a new course but it’s usually for a very limited time

  • @alanesaugarciagutierrez6025

    If we try to migrate from 1 to 4 the automigrations runs 1 to 2, 2 to 3 and 3 to 4?

  • @surendramaran
    @surendramaran Рік тому +1

    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  Рік тому +1

      Glad it helps, I'm from Germany :)

    • @Ibeatuphomelesspeople
      @Ibeatuphomelesspeople Рік тому

      @@PhilippLackner how is germany? thinking about visiting eastern europe or germany

  • @orangasli2943
    @orangasli2943 Рік тому

    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

  • @naveensuyambu6222
    @naveensuyambu6222 Рік тому

    Please do the same for realm as well Philip

    • @ChrisAthanas
      @ChrisAthanas Рік тому

      Likely won’t happen since it’s not recommend by Google anymore

  • @gstarentertainmentedits2415
    @gstarentertainmentedits2415 Рік тому +1

    👌👌🙏🙏

  • @ZsP3X
    @ZsP3X Рік тому

    5 minutes in and tNice tutorials is 10 tis harder than garageband on my phone

  • @chani_vlogs
    @chani_vlogs Рік тому

    i love u

  • @dusknews9939
    @dusknews9939 Рік тому

    can you please start explaining instead of just writing codes,

  • @ProfMohamedAtef
    @ProfMohamedAtef Рік тому

    Your effort is very nice, but why @RenameColumn, @DeleteColumn, @ RenamTable, @DeleteTable, are not working with AutoMigrationSpec ?

  • @nguyencodervn
    @nguyencodervn Рік тому

    Thank you