refactor: almost final migrations cleanup - #1456
Conversation
Bumping the auto increment value has been done since the original sql PR, so it doesn't need to be done on migrations. See e5e7b8a.
The only table that has been added since DB version 6 (the earliest supported version), is the versions table in DB version 101. This commit removes the "create all tables" statement, and instead creates the versions table in the 101 migration. See 12e074b.
CyanVoxel
left a comment
There was a problem hiding this comment.
Looks like somethings not quite right with the migrations, here I threw in a DB 9 library and it failed on migration 200:

2026-07-24 03:51:02 [info ] [Library][Migration][200] Starting DB Migration
2026-07-24 03:51:02 [info ] [Library][Migration][200] Dropping boolean_fields and value_type tables...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Adding name columns to field tables...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Dropping position columns to field tables...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Adding is_multiline column to text_fields...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Moving values from type_key columns to name...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Normalizing TextField names...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Normalizing DatetimeField names...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Updating is_multiline for legacy TEXT_BOXes...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Repairing legacy Description fields...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Repairing legacy Comment fields...
2026-07-24 03:51:02 [info ] [Library][Migration][200] Adding default field templates...
2026-07-24 03:51:02 [error ] (sqlite3.OperationalError) no such table: datetime_field_templates
[SQL: INSERT INTO datetime_field_templates (name) VALUES (?)]
[parameters: ('Date',)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Verified working on main
Yeah turns out the one time I didn't test, I overlooked something ^^' I forgot that adding relationships also adds tables that need to be created. |
| session.flush() | ||
| else: | ||
| session.commit() | ||
| logger.info(f"[Library][Migration][{migration.version}] Completed DB Migration") |
There was a problem hiding this comment.
Wouldn't this print even if the migration fails? Just a little nit pick
There was a problem hiding this comment.
the method would stop executing on the error like normal, no?
Summary
Progress on #1442.
Aims to complete the migrations cleanup far enough that only independence from sqlalchemy remains.
todo:
Tasks Completed