Skip to content

migrations #31

@Nareshix

Description

@Nareshix

SQLite has very little built-in schema alteration support, and so Django attempts to emulate it by:

Creating a new table with the new schema

Copying the data across

Dropping the old table

Renaming the new table to match the original name

migrations shuold be done atomically, hence in a transasction

SQLite only allows very limited changes to be done to an existing table. For anything else, you should:

rename the old table,
make a new table with the old name and with the correct column definitions,
copy the data over, and
drop the old table.
Do this within a single transaction, of course! Also, practice on another database before trying this with your production data.

https://www.sqlite.org/lang_altertable.html
https://docs.djangoproject.com/en/6.0/topics/migrations/

https://github.com/rust-db/refinery

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions