Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set initial schema version? #35

Open
cthu1hoo opened this issue Mar 3, 2021 · 1 comment
Open

Is there a way to set initial schema version? #35

cthu1hoo opened this issue Mar 3, 2021 · 1 comment
Assignees

Comments

@cthu1hoo
Copy link

cthu1hoo commented Mar 3, 2021

i.e. assume that base schema corresponds to version X instead of "0". otherwise i'm not sure how should this be integrated with an application that has extant migrations.

my thought was to create migrations record table filled with initial data in the base schema but it seems hackish somehow.

a few additional thoughts:

  • it seems to me that having base schema at version 0, always, and running all migrations all the time would quickly
    become unwieldy
  • more importantly, over the years database syntax may change and older migrations may become incompatible with newer database server releases (this happened to me both with postgres and mysql).

therefore, i normally keep base schema at latest version and support migrations from older installed schemas as needed.

thanks for any advice.

@byjg byjg self-assigned this Mar 3, 2021
@byjg
Copy link
Owner

byjg commented Mar 15, 2021

Hello, it is possible to have a base from different versions. Basically, the system uses the base.sql here and we start from "0" here.

So, it means, if we manage getBaseSql() to get a base.sql file in the format "base-nnnnn.sql" (where nnnnn is the version) we can trick the system to start the migration from that version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants