question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get database/driver instance when using migrateWithCallbacks on Android?

See original GitHub issue

SQLDelight version: 1.5.0 Application OS: Android

I’m trying to get the new migrateWithCallbacks working, looks straight forward, however there seems to be a circular dependency when using it with AndroidSqliteDriver, unless I’m missing something

AndroidSqliteDriver(
            context = context,
            schema = AppDatabase.Schema,
            name = "mydb",
            callback = AndroidSqliteDriver.Callback(schema = schema, AfterVersion(3) {
                // database or driver instance, to execute some sql?
            })

It runs the migrateWithCallbacks when nonempty list of AfterVersion’s, which is Callback’s argument, which is AndroidSqliteDriver’s argument

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
recoverrelaxcommented, May 5, 2021

any news on this ?

0reactions
ahmedrecommented, Oct 12, 2021

fix for this is merged now - @AlecStrong may you close this one please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating Room databases | Android Developers
Learn to migrate databases safely using the Room Library.
Read more >
migrateWithCallbacks - SQLDelight - Cash App Code Blog
Run SqlDriver.Schema.migrate normally but execute callbacks during the migration whenever it finished upgrading to a version specified by AfterVersion.
Read more >
How can I persist user data on updating/migrating a database?
How to achieve this using Android Room? The only workaround I found : Use fallbackToDestructiveMigration . Update asset .db file so that it ......
Read more >
How to get database/driver instance when using ...
SQLDelight version: 1.5.0 Application OS: Android I'm trying to get the new migrateWithCallbacks working, looks straight forward, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found