slick-migration-api icon indicating copy to clipboard operation
slick-migration-api copied to clipboard

Documentation

Open stefanholzmueller opened this issue 5 years ago • 3 comments

Hey. I'm looking for a lightweight database migration tool and found this project through the Slick documentation. It seems to be up-to-date and the example looks intriguing. I was wondering if it is a good fit for my project and started reading the source code. That helped my understanding a bit, but the "big picture" is still quite blurry.

I'd like to read some high-level documentation, like

  • How does it work
  • How does it compare to other tools
  • What can it do, what not

A few paragraphs in the README would be super-helpful.

PS: If you don't mind, I'll ask more specific questions here. I stumbled upon a Gitter channel, but it seems to be dead.

stefanholzmueller avatar Apr 19 '19 18:04 stefanholzmueller

Which gitter channel?

Sorry for lack of docs. As for how to use it, it's not a migration tool on its own, just a library with a trait hierarchy for expressing migrations as Slick actions, and a DSL to define then as operations relative to a Slick schema. You can use it with any migration tool. I used it with Flyway. There's another library, slick-migration-api-flyway, that provides some missing pieces to integrate it.

I confess that recently I stopped using it in my own code (after using it for many years in a large project). The problem is that it means your migrations have a dependency on your code, and of course the database has a dependency on the migrations, but your Slick code (generated and otherwise) are a dependency of your code on the database. This creates a conceptual dependency cycle.

One issue is that old migrations become invalid, so you end up having to create schema classes representing older snapshots and older migrations have to be defined relative to them. Either you do this as necessary and inconsistently, or it's a lot of work. I believe Forklift addresses this though I confess I haven't tried it.

Perhaps in the past, when I was less comfortable writing SQL, and was without the helpfulness of today's excellent SQL support in intellij, having a DSL was much more beneficial. However now I find being able to just write plain SQL files, using Flyway directly, much more frictionless.

On Fri, Apr 19, 2019, 2:38 PM Stefan Holzmüller [email protected] wrote:

Hey. I'm looking for a lightweight database migration tool and found this project through the Slick documentation. It seems to be up-to-date and the example looks intriguing. I was wondering if it is a good fit for my project and started reading the source code. That helped my understanding a bit, but the "big picture" is still quite blurry.

I'd like to read some high-level documentation, like

  • How does it work
  • How does it compare to other tools
  • What can it do, what not A few paragraphs in the README would be super-helpful.

PS: If you don't mind, I'll ask more specific questions here. I stumbled upon a Gitter channel, but it seems to be dead.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nafg/slick-migration-api/issues/32, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAYAUF74F6NO3362ZBAEPTPRIGRNANCNFSM4HHGWNTQ .

nafg avatar Apr 22 '19 07:04 nafg

Thank you very much for this elaborate response! I see now that I misunderstood the goal of this project. I was wondering myself how to deal with old table columns and so on.

I will now probably use Flyway directly and keep the migrations in sync with Slick table definitions manually. Forklift seems to avoid this with code generation, but I have not actually used it, too.

P.S.: I found this somehow: https://gitter.im/nafg/slick-migration-api/

stefanholzmueller avatar Apr 22 '19 07:04 stefanholzmueller

Should this be closed?

nafg avatar Mar 19 '21 03:03 nafg