Merge branch 'libretime:main' into master-me-processing
This commit is contained in:
commit
59ba09bd2c
|
@ -8,8 +8,6 @@ UP = """
|
||||||
-- DELETE FROM cc_pref WHERE keystr = 'system_version';
|
-- DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||||
-- INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.5');
|
-- INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.5');
|
||||||
|
|
||||||
ALTER TABLE cc_show ADD COLUMN image_path varchar(255) DEFAULT '';
|
|
||||||
ALTER TABLE cc_show_instances ADD COLUMN description varchar(255) DEFAULT '';
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DOWN = None
|
DOWN = None
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import migrations
|
||||||
from ._migrations import legacy_migration_factory
|
from ._migrations import legacy_migration_factory
|
||||||
|
|
||||||
UP = """
|
UP = """
|
||||||
ALTER TABLE cc_files ADD COLUMN artwork TYPE character varying(255);
|
ALTER TABLE cc_files ADD COLUMN artwork VARCHAR(255);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DOWN = None
|
DOWN = None
|
||||||
|
|
|
@ -4,12 +4,18 @@ from django.db import migrations
|
||||||
|
|
||||||
from ._migrations import legacy_migration_factory
|
from ._migrations import legacy_migration_factory
|
||||||
|
|
||||||
|
# This migration is currently a placeholder for 3.0.0-alpha.9.1.
|
||||||
|
# Please do not remove it. There are currently no actions, but it
|
||||||
|
# needs to remain intact so it does not fail when called from the
|
||||||
|
# migrations script. Any future migrations that may apply to
|
||||||
|
# 3.0.0-alpha.9.1 will be added to this file.
|
||||||
|
|
||||||
UP = """
|
UP = """
|
||||||
ALTER TABLE cc_files ADD COLUMN artwork VARCHAR(4096);
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
DOWN = """
|
DOWN = """
|
||||||
ALTER TABLE cc_files DROP COLUMN IF EXISTS artwork;
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,28 @@ def get_schema_version():
|
||||||
|
|
||||||
Don't use django models as they might break in the future. Our concern is to upgrade
|
Don't use django models as they might break in the future. Our concern is to upgrade
|
||||||
the legacy database schema to the point where django is in charge of the migrations.
|
the legacy database schema to the point where django is in charge of the migrations.
|
||||||
|
|
||||||
|
An airtime 2.5.1 migration will not have schema_version, in that case, we look for
|
||||||
|
system_version to have a value of 2.5.1 and return that as the schema version value
|
||||||
|
(really just needs to be anything besides None, so that the next migration doesn't overwrite
|
||||||
|
the database)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if "cc_pref" not in connection.introspection.table_names():
|
if "cc_pref" not in connection.introspection.table_names():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
cursor.execute("SELECT valstr FROM cc_pref WHERE keystr = 'schema_version'")
|
cursor.execute(
|
||||||
|
"""
|
||||||
|
SELECT valstr AS version
|
||||||
|
FROM cc_pref
|
||||||
|
WHERE (keystr = 'schema_version') OR (keystr = 'system_version' AND valstr = '2.5.1')
|
||||||
|
"""
|
||||||
|
)
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
return row[0] if row else None
|
if row and row[0]:
|
||||||
|
return row[0]
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def set_schema_version(cursor, version: str):
|
def set_schema_version(cursor, version: str):
|
||||||
|
|
Loading…
Reference in New Issue