Reshuffle schema versions after rebase

This commit is contained in:
Stephan Kulow 2022-10-26 14:36:43 +02:00
parent 9dbf3b9094
commit 1346223822

View File

@ -161,9 +161,8 @@ class DB:
"UPDATE scheme SET version=12", "UPDATE scheme SET version=12",
) )
schemes[13] = ( schemes[13] = (
"""DROP TABLE IF EXISTS linked_revs""", "DROP TABLE IF EXISTS users",
""" """CREATE TABLE users (
CREATE TABLE users (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
userid VARCHAR(255) NOT NULL, userid VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL,
@ -171,8 +170,9 @@ class DB:
) )
""", """,
"UPDATE scheme SET version=13", "UPDATE scheme SET version=13",
), )
schemes[14] = ( schemes[14] = (
"DROP TABLE IF EXISTS linked_revs",
""" """
CREATE TABLE linked_revs ( CREATE TABLE linked_revs (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
@ -182,11 +182,11 @@ class DB:
""", """,
"UPDATE scheme SET version=14", "UPDATE scheme SET version=14",
) )
schemes[14] = (
"ALTER TABLE revisions ALTER COLUMN rev TYPE real USING rev::real",
"UPDATE scheme SET version=14",
)
schemes[15] = ( schemes[15] = (
"ALTER TABLE revisions ALTER COLUMN rev TYPE real USING rev::real",
"UPDATE scheme SET version=15",
)
schemes[16] = (
"""DROP TABLE IF EXISTS fake_revs""", """DROP TABLE IF EXISTS fake_revs""",
""" """
CREATE TABLE fake_revs ( CREATE TABLE fake_revs (
@ -196,16 +196,16 @@ class DB:
) )
""", """,
"create index revs_linked on fake_revs (revision_id,linked_id)", "create index revs_linked on fake_revs (revision_id,linked_id)",
"UPDATE scheme SET version=15",
)
schemes[16] = (
"ALTER TABLE revisions ADD COLUMN files_hash VARCHAR(40)",
"UPDATE scheme SET version=16", "UPDATE scheme SET version=16",
) )
schemes[17] = ( schemes[17] = (
"ALTER TABLE linked_revs ADD COLUMN considered BOOLEAN DEFAULT FALSE", "ALTER TABLE revisions ADD COLUMN files_hash VARCHAR(40)",
"UPDATE scheme SET version=17", "UPDATE scheme SET version=17",
) )
schemes[18] = (
"ALTER TABLE linked_revs ADD COLUMN considered BOOLEAN DEFAULT FALSE",
"UPDATE scheme SET version=18",
)
schema_version = self.schema_version() schema_version = self.schema_version()
if (schema_version + 1) not in schemes: if (schema_version + 1) not in schemes:
return return