slick-migration-api purpose
See original GitHub issueIt is not really an issue but more a request for making things clearer on the purpose of this lib. Sorry if it is not the right place to do it.
Is this lib done for propagate changes made in the db scheme to an already existing db ?
For instance I built a h2 db with a USERS table, added some entries with slick. The h2 file is built, the rows exist. Then I added a column TOTO in my slick table definition. I need to propagate this change to my h2 db file so that they are still compatible. So I did this:
val init = TableMigration(dbScheme.users)
.addColumns(_.toto)
db.run(init())
My h2 db file is modified but I cannot see a new column TOTO. Is it the right way to achive this ?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
nafg/slick-migration-api: Schema manipulation dialects and ...
Write typesafe and typo-safe database migrations, using your existing Slick table definitions. Pipeline Status · Coverage Status · Maven Central. Dependency ...
Read more >mysql - Slick Database Migrations - Stack Overflow
I'm working on a project using Scala which uses Slick.io for handling database interactions. I have the database schema implemented via ...
Read more >slick-migration-api-flyway - Scaladex
This library is an adapter between the Flyway database migration tool and the slick-migration-api library. One can aggregate scala.slick.migration.api.
Read more >How to create RESTful API with Scala, Play, Silhouette and Slick
The given article can help you out with creating a RESTful API with Play Framework, Slick ORM, PostgreSQL and Silhouette JWT authentication/authorization.
Read more >Replace your old API platform - Tyk.io
Slick, strategic and supportive API migration ... analytics puts you in a powerful position to achieve your migration and ongoing API management goals....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I created a repo reproducing the bug: https://github.com/mathieuleclaire/testSlickMigration. You can either producing the initial table following the instructions in the README or use this prebuilt table (containing only two columns): h2.mv.db.tar.gz
Can you reproduce ?
Hi, apologies for not looking into this earlier.
Here are my findings:
After following instructions in the readme, it did not print FINISHED. The .mv.db file had not been updated, but the sibling .trace.db file was. It contained:
So H2 couldn’t open the file and change it because it was interrupted. Apparently, the JVM terminated before it was done. As I explained earlier, and as you can see by looking at its type, Slick’s
runmethod returns aFuture, so just because it returns doesn’t mean the work has been done already. That’s what asynchronous means.I then changed the code to this:
Now it blocks so the migration has a chance to run. However it gives a different error:
This is a problem with your logic; it’s impossible to add a non-nullable column to a database without a default value.
I plan to add to
slick-migration-apia method that lets you do the following in one step: Add the column except nullable, populate it with a specified value or sql expression, and then set it nullable.However the simpler solution is to just set an
O.Default(defaultValue)column option.If you still have trouble please open a new issue (you can reference this one).