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.

Is there a migration helper for JdbcSqliteDriver?

See original GitHub issue

Initializing a Jdbc database with:

val driver: SqlDriver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
Database.Schema.create(driver)

fails the second time with [SQLITE_ERROR] SQL error or missing database (table records already exists).

What is the correct way to handle this case? The Android driver has SupportSQLiteOpenHelper, would it make sense to add similar functionality for JdbcSqliteDriver? Maybe using user_version pragma or something else?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
bubelovcommented, May 17, 2021

@martinbonnin got it, thanks for the link!

1reaction
martinbonnincommented, Jan 15, 2021

If anyone comes here, another exemple is https://github.com/JakeWharton/dodo/blob/69185c6d571129d1ffe637cdabe987a9ddbd8b5c/src/main/kotlin/com/jakewharton/dodo/db.kt#L13-L35

Also I was made aware that this doesn’t work super well in multi-process server scenario where multiple clients connect to the same database and it’s not really an option to take the database “offline” while doing the migration. This all makes sense and is another argument for making this out of scope for SQLDelight

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview of Data Migration Assistant - SQL - Microsoft Learn
Learn how to use Data Migration Assistant to migrate SQL Server databases to other SQL Server or Azure databases.
Read more >
Migrating Room databases | Android Developers
Learn to migrate databases safely using the Room Library. ... Create earliest version of the database. helper.createDatabase(TEST_DB, 1).apply { close() }
Read more >
Gormigrate - Go Packages
Gormigrate is a minimalistic migration helper for Gorm. Gorm already has useful migrate functions, just misses proper schema versioning and ...
Read more >
Migration Style Guide - GitLab Docs
Migration helpers and versioning. Introduced in GitLab 14.3. Various helper methods are available for many common patterns in database migrations. Those helpers ...
Read more >
Understanding migrations with Room | by Florina Muntenescu
Database migrations under the hood. What SQLite API does. SQLite databases handle schema changes with the help of database versioning. More precisely, every ......
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