Skip to content

Migration strategy using alterTable method #1350

Answered by simolus3
maxstubbersfield asked this question in Q&A
Discussion options

You must be logged in to vote

One solution I thought of was copying the generated table into another file and run the alterTable method on that table (frozen for that version)

It's a bit hacky to copy around files generated by build_runner, but you can actually make moor generate a stripped-down version of your table classes which can pretty much only be used for a schema.
Basically, whenever you change your schema you'll want to run this command. There's another command described in the docs that will emit table classes for each saved schema version. I designed this for testing purposes, but someone came up with the idea of using those generated files for the migration itself. I can't find the original discussion f…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@maxstubbersfield
Comment options

@maxstubbersfield
Comment options

Answer selected by maxstubbersfield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants