Skip to content

SQL schema versioning #92

@rokf

Description

@rokf

Hello,

I was wondering if you've perhaps already discussed what to do about SQL schema versioning. Let's say that a model changes in such a way that the SQL schema would need to be changed. What will your approach be in that case?

Will you generate the new SQL schema file and replace the existing SQL schema file in the relevant repository or will a patch migration be generated so that one can only apply the patch and reuse the existing data that they've already stored in the table for the model?

In the first case (SQL schema file replaced) each user of the SQL schema file would have to deal with the differences themselves (decide what to do) i.e.:

  • drop the table and insert the data into a new table with the modified schema (fresh start)
  • figure out the schema differences and prepare a custom migration, either manually or using a specialised tool that can do that, i.e. https://github.com/ariga/atlas

I know that this is a tricky subject since the same approach likely won't suit everyone 🤔

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions