feat: replace php migration with django migration
- keep latest legacy version in initial migration file - move propel schema to api legacy app - remove legacy upgrade tool
This commit is contained in:
parent
ee98387264
commit
0e4bc4cacd
85 changed files with 1005 additions and 1000 deletions
0
api/libretime_api/legacy/__init__.py
Normal file
0
api/libretime_api/legacy/__init__.py
Normal file
7
api/libretime_api/legacy/apps.py
Normal file
7
api/libretime_api/legacy/apps.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class LegacyConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "libretime_api.legacy"
|
||||
verbose_name = "LibreTime Legacy"
|
29
api/libretime_api/legacy/migrations/0001_initial.py
Normal file
29
api/libretime_api/legacy/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from pathlib import Path
|
||||
|
||||
from django.db import connection, migrations
|
||||
|
||||
from . import LEGACY_SCHEMA_VERSION
|
||||
from ._migrations import get_schema_version, set_schema_version
|
||||
|
||||
here = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def create_schema(_apps, _schema_editor):
|
||||
schema_version = get_schema_version()
|
||||
|
||||
# A schema already exists, don't overwrite !
|
||||
if schema_version is not None:
|
||||
return
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
for migration_filename in ("schema.sql", "data.sql"):
|
||||
raw = (here / "sql" / migration_filename).read_text(encoding="utf-8")
|
||||
cursor.execute(raw)
|
||||
|
||||
set_schema_version(cursor, LEGACY_SCHEMA_VERSION)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
dependencies = []
|
||||
operations = [migrations.RunPython(create_schema)]
|
28
api/libretime_api/legacy/migrations/0003_2_5_2.py
Normal file
28
api/libretime_api/legacy/migrations/0003_2_5_2.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
-- Replacing system_version with schema_version
|
||||
DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('schema_version', '2.5.2');
|
||||
|
||||
ALTER TABLE cc_show ADD COLUMN image_path varchar(255) DEFAULT '';
|
||||
ALTER TABLE cc_show_instances ADD COLUMN description varchar(255) DEFAULT '';
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0001_initial"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.2",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
28
api/libretime_api/legacy/migrations/0004_2_5_3.py
Normal file
28
api/libretime_api/legacy/migrations/0004_2_5_3.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
-- DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
-- INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.5.3');
|
||||
|
||||
ALTER TABLE cc_files DROP COLUMN state;
|
||||
ALTER TABLE cc_files ADD import_status integer default 1; -- Default is "pending"
|
||||
UPDATE cc_files SET import_status=0; -- Existing files are already "imported"
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0003_2_5_2"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.3",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
61
api/libretime_api/legacy/migrations/0005_2_5_4.py
Normal file
61
api/libretime_api/legacy/migrations/0005_2_5_4.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = None
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
def promote_admin_to_superadmin(cursor):
|
||||
# Ensure there are no superadmins already
|
||||
super_admin_count = cursor.execute(
|
||||
"""
|
||||
SELECT COUNT(id)
|
||||
FROM cc_subjs
|
||||
WHERE type = 'S'
|
||||
AND login != 'sourcefabric_admin';
|
||||
"""
|
||||
).fetchone()
|
||||
if super_admin_count != 0:
|
||||
return
|
||||
|
||||
# Promote the "admin" user to superadmin
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE cc_subjs SET type = 'S'
|
||||
WHERE login = 'admin';
|
||||
"""
|
||||
)
|
||||
if cursor.rowcount == 0:
|
||||
# Otherwise promote the administrator with the lowest ID
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE cc_subjs SET type = 'S'
|
||||
WHERE id = (
|
||||
SELECT id
|
||||
FROM cc_subjs
|
||||
WHERE type = 'A'
|
||||
ORDER BY id
|
||||
LIMIT 1
|
||||
);
|
||||
"""
|
||||
)
|
||||
if cursor.rowcount == 0:
|
||||
raise RuntimeError("Failed to find any users of type 'admin' ('A')")
|
||||
|
||||
# Ignoring the sourcefabric_admin user
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0004_2_5_3"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.4",
|
||||
before=promote_admin_to_superadmin,
|
||||
)
|
||||
)
|
||||
]
|
27
api/libretime_api/legacy/migrations/0006_2_5_5.py
Normal file
27
api/libretime_api/legacy/migrations/0006_2_5_5.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
-- DELETE FROM cc_pref WHERE keystr = 'system_version';
|
||||
-- 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
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0005_2_5_4"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.5",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
33
api/libretime_api/legacy/migrations/0007_2_5_9.py
Normal file
33
api/libretime_api/legacy/migrations/0007_2_5_9.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
CREATE TABLE cloud_file
|
||||
(
|
||||
id serial NOT NULL,
|
||||
resource_id text NOT NULL,
|
||||
storage_backend text NOT NULL,
|
||||
cc_file_id integer NOT NULL,
|
||||
CONSTRAINT cloud_file_pkey PRIMARY KEY (id),
|
||||
CONSTRAINT "cloud_file_FK_1" FOREIGN KEY (cc_file_id)
|
||||
REFERENCES cc_files (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION ON DELETE CASCADE
|
||||
)
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0006_2_5_5"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.9",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
24
api/libretime_api/legacy/migrations/0008_2_5_10.py
Normal file
24
api/libretime_api/legacy/migrations/0008_2_5_10.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files ADD COLUMN filesize integer NOT NULL
|
||||
CONSTRAINT filesize_default DEFAULT 0
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0007_2_5_9"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.10",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
33
api/libretime_api/legacy/migrations/0009_2_5_11.py
Normal file
33
api/libretime_api/legacy/migrations/0009_2_5_11.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = None
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
def update_disk_usage(cursor):
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE cc_pref SET valstr = (
|
||||
SELECT SUM(filesize)
|
||||
FROM cc_files
|
||||
)
|
||||
WHERE keystr = 'disk_usage';
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0008_2_5_10"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.11",
|
||||
sql=update_disk_usage,
|
||||
)
|
||||
)
|
||||
]
|
24
api/libretime_api/legacy/migrations/0010_2_5_12.py
Normal file
24
api/libretime_api/legacy/migrations/0010_2_5_12.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_show ALTER COLUMN description TYPE varchar(8192);
|
||||
ALTER TABLE cc_show_instances ALTER COLUMN description TYPE varchar(8192);
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0009_2_5_11"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.12",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
79
api/libretime_api/legacy/migrations/0011_2_5_13.py
Normal file
79
api/libretime_api/legacy/migrations/0011_2_5_13.py
Normal file
|
@ -0,0 +1,79 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "third_party_track_references"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"service" VARCHAR(256) NOT NULL,
|
||||
"foreign_id" VARCHAR(256),
|
||||
"file_id" INTEGER NOT NULL,
|
||||
"upload_time" TIMESTAMP,
|
||||
"status" VARCHAR(256),
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "foreign_id_unique" UNIQUE ("foreign_id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "celery_tasks"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"task_id" VARCHAR(256) NOT NULL,
|
||||
"track_reference" INTEGER NOT NULL,
|
||||
"name" VARCHAR(256),
|
||||
"dispatch_time" TIMESTAMP,
|
||||
"status" VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "id_unique" UNIQUE ("id")
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "third_party_track_references" ADD CONSTRAINT "track_reference_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "celery_tasks" ADD CONSTRAINT "celery_service_fkey"
|
||||
FOREIGN KEY ("track_reference")
|
||||
REFERENCES "third_party_track_references" ("id")
|
||||
ON DELETE CASCADE;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS "third_party_track_references" CASCADE;
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS "celery_tasks" CASCADE;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0010_2_5_12"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.13",
|
||||
sql=UP,
|
||||
),
|
||||
reverse_code=legacy_migration_factory(
|
||||
target="2.5.12",
|
||||
sql=DOWN,
|
||||
reverse=True,
|
||||
),
|
||||
)
|
||||
]
|
28
api/libretime_api/legacy/migrations/0012_2_5_14.py
Normal file
28
api/libretime_api/legacy/migrations/0012_2_5_14.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
# SAAS-923
|
||||
# Add a partial constraint to cc_pref so that keystrings must be unique
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref;
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0011_2_5_13"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.14",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
30
api/libretime_api/legacy/migrations/0013_2_5_15.py
Normal file
30
api/libretime_api/legacy/migrations/0013_2_5_15.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
# SAAS-1071
|
||||
# Remove not null constraint from file_id fk in third_party_track_references
|
||||
# so that we can create track references for downloads (which won't have a
|
||||
# file ID until the task is run and the file is POSTed back to Airtime)
|
||||
|
||||
UP = """
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0012_2_5_14"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.15",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
125
api/libretime_api/legacy/migrations/0014_2_5_16.py
Normal file
125
api/libretime_api/legacy/migrations/0014_2_5_16.py
Normal file
|
@ -0,0 +1,125 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files ADD COLUMN description VARCHAR(512);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"url" VARCHAR(4096) NOT NULL,
|
||||
"title" VARCHAR(4096) NOT NULL,
|
||||
"creator" VARCHAR(4096),
|
||||
"description" VARCHAR(4096),
|
||||
"language" VARCHAR(4096),
|
||||
"copyright" VARCHAR(4096),
|
||||
"link" VARCHAR(4096),
|
||||
"itunes_author" VARCHAR(4096),
|
||||
"itunes_keywords" VARCHAR(4096),
|
||||
"itunes_summary" VARCHAR(4096),
|
||||
"itunes_subtitle" VARCHAR(4096),
|
||||
"itunes_category" VARCHAR(4096),
|
||||
"itunes_explicit" VARCHAR(4096),
|
||||
"owner" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- station_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "station_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- imported_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "imported_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"auto_ingest_timestamp" TIMESTAMP,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast_episodes
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "podcast_episodes"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
"publication_date" TIMESTAMP NOT NULL,
|
||||
"download_url" VARCHAR(4096) NOT NULL,
|
||||
"episode_guid" VARCHAR(4096) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey"
|
||||
FOREIGN KEY ("owner")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "station_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "imported_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_cc_files_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_files DROP COLUMN description;
|
||||
|
||||
DELETE FROM cc_pref WHERE keystr = 'station_podcast_id';
|
||||
|
||||
DROP TABLE IF EXISTS "podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "imported_podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "station_podcast" CASCADE;
|
||||
|
||||
DROP TABLE IF EXISTS "podcast_episodes" CASCADE;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0013_2_5_15"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.16",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
23
api/libretime_api/legacy/migrations/0015_2_5_17.py
Normal file
23
api/libretime_api/legacy/migrations/0015_2_5_17.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files ADD COLUMN artwork TYPE character varying(255);
|
||||
"""
|
||||
|
||||
DOWN = None
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0014_2_5_16"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="2.5.17",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
29
api/libretime_api/legacy/migrations/0016_3_0_0_alpha.py
Normal file
29
api/libretime_api/legacy/migrations/0016_3_0_0_alpha.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_show ADD COLUMN has_autoplaylist boolean default 'f' NOT NULL;
|
||||
ALTER TABLE cc_show ADD COLUMN autoplaylist_id integer DEFAULT NULL;
|
||||
ALTER TABLE cc_show_instances ADD COLUMN autoplaylist_built boolean default 'f' NOT NULL;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_show_instances DROP COLUMN IF EXISTS autoplaylist_built;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS has_autoplaylist;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_id;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0015_2_5_17"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
31
api/libretime_api/legacy/migrations/0017_3_0_0_alpha_1.py
Normal file
31
api/libretime_api/legacy/migrations/0017_3_0_0_alpha_1.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE imported_podcast ADD COLUMN album_override boolean default 'f' NOT NULL;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET DEFAULT 0;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP NOT NULL;
|
||||
ALTER TABLE cc_show ADD COLUMN autoplaylist_repeat boolean default 'f' NOT NULL;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE imported_podcast DROP COLUMN IF EXISTS album_override;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id DROP DEFAULT;
|
||||
ALTER TABLE third_party_track_references ALTER COLUMN file_id SET NOT NULL;
|
||||
ALTER TABLE cc_show DROP COLUMN IF EXISTS autoplaylist_repeat;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0016_3_0_0_alpha"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.1",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
25
api/libretime_api/legacy/migrations/0018_3_0_0_alpha_6.py
Normal file
25
api/libretime_api/legacy/migrations/0018_3_0_0_alpha_6.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_service_register ALTER COLUMN ip TYPE character varying(45);
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_service_register ALTER COLUMN ip TYPE character varying(18);
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0017_3_0_0_alpha_1"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.6",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
29
api/libretime_api/legacy/migrations/0019_3_0_0_alpha_7.py
Normal file
29
api/libretime_api/legacy/migrations/0019_3_0_0_alpha_7.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
# https://github.com/libretime/libretime/pull/636
|
||||
# Change dynamic smartblock to be default smartblock type
|
||||
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'dynamic';
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_block ALTER COLUMN type SET DEFAULT 'static';
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0018_3_0_0_alpha_6"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.7",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
30
api/libretime_api/legacy/migrations/0020_3_0_0_alpha_7_1.py
Normal file
30
api/libretime_api/legacy/migrations/0020_3_0_0_alpha_7_1.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
# https://github.com/libretime/libretime/pull/659
|
||||
# Add description and title to podcast episodes database table
|
||||
|
||||
UP = """
|
||||
ALTER TABLE podcast_episodes ADD COLUMN episode_title VARCHAR(4096);
|
||||
ALTER TABLE podcast_episodes ADD COLUMN episode_description VARCHAR(4096);
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_title;
|
||||
ALTER TABLE podcast_episodes DROP COLUMN IF EXISTS episode_description;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0019_3_0_0_alpha_7"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.7.1",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
28
api/libretime_api/legacy/migrations/0021_3_0_0_alpha_7_2.py
Normal file
28
api/libretime_api/legacy/migrations/0021_3_0_0_alpha_7_2.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
# https://github.com/libretime/libretime/pull/704
|
||||
# Add criteria group to smartblock table to enable database to store separately
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_blockcriteria ADD COLUMN criteriagroup integer;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_blockcriteria DROP COLUMN IF EXISTS criteriagroup;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0020_3_0_0_alpha_7_1"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.7.2",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
25
api/libretime_api/legacy/migrations/0022_3_0_0_alpha_7_3.py
Normal file
25
api/libretime_api/legacy/migrations/0022_3_0_0_alpha_7_3.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE podcast_episodes ALTER COLUMN episode_description TYPE text;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE podcast_episodes ALTER COLUMN episode_description TYPE VARCHAR(4096);
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0021_3_0_0_alpha_7_2"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.7.3",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
25
api/libretime_api/legacy/migrations/0023_3_0_0_alpha_9_1.py
Normal file
25
api/libretime_api/legacy/migrations/0023_3_0_0_alpha_9_1.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files ADD COLUMN artwork VARCHAR(4096);
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_files DROP COLUMN IF EXISTS artwork;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0022_3_0_0_alpha_7_3"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.9.1",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
51
api/libretime_api/legacy/migrations/0024_3_0_0_alpha_9_2.py
Normal file
51
api/libretime_api/legacy/migrations/0024_3_0_0_alpha_9_2.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files ADD COLUMN track_type VARCHAR(16);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "cc_track_types"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"code" VARCHAR(16) NOT NULL,
|
||||
"type_name" VARCHAR(64),
|
||||
"description" VARCHAR(255),
|
||||
"visibility" boolean DEFAULT true NOT NULL,
|
||||
CONSTRAINT "cc_track_types_pkey" PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_track_types_code_key" UNIQUE ("code")
|
||||
);
|
||||
|
||||
INSERT INTO cc_track_types VALUES (1, 'MUS', 'Music', 'This is used for tracks containing music.', true);
|
||||
INSERT INTO cc_track_types VALUES (2, 'SID', 'Station ID', 'This is used for Station IDs', true);
|
||||
INSERT INTO cc_track_types VALUES (3, 'INT', 'Show Intro', 'This can be used for organizing all the show introductions.', true);
|
||||
INSERT INTO cc_track_types VALUES (4, 'OUT', 'Show Outro', 'This can be used for organizing all the show outroductions.', true);
|
||||
INSERT INTO cc_track_types VALUES (5, 'SWP', 'Sweeper', 'This is used for segues between songs.', true);
|
||||
INSERT INTO cc_track_types VALUES (6, 'JIN', 'Jingle', 'A short song or tune, normally played during commercial breaks. Contains one or more hooks.', true);
|
||||
INSERT INTO cc_track_types VALUES (7, 'PRO', 'Promo', 'For promotional use.', true);
|
||||
INSERT INTO cc_track_types VALUES (8, 'SHO', 'Shout Out', 'A message of congratulation, greeting. support, or appreciation. ', true);
|
||||
INSERT INTO cc_track_types VALUES (9, 'NWS', 'News', 'This is used for noteworthy information, announcements.', true);
|
||||
INSERT INTO cc_track_types VALUES (10, 'COM', 'Commercial', 'This is used for commercial advertising.', true);
|
||||
INSERT INTO cc_track_types VALUES (11, 'ITV', 'Interview', 'This is used for radio interviews', true);
|
||||
INSERT INTO cc_track_types VALUES (12, 'VTR', 'Voice Tracking', 'Also referred as robojock or taped. Make announcements without actually being in the station.', true);
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_files DROP COLUMN IF EXISTS track_type;
|
||||
|
||||
DROP TABLE IF EXISTS "cc_track_types" CASCADE;
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0023_3_0_0_alpha_9_1"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.9.2",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
34
api/libretime_api/legacy/migrations/0025_3_0_0_alpha_9_3.py
Normal file
34
api/libretime_api/legacy/migrations/0025_3_0_0_alpha_9_3.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
DROP TABLE IF EXISTS "cc_smemb" CASCADE;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
CREATE TABLE "cc_smemb"
|
||||
(
|
||||
"id" INTEGER NOT NULL,
|
||||
"uid" INTEGER DEFAULT 0 NOT NULL,
|
||||
"gid" INTEGER DEFAULT 0 NOT NULL,
|
||||
"level" INTEGER DEFAULT 0 NOT NULL,
|
||||
"mid" INTEGER,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_smemb_id_idx" UNIQUE ("id")
|
||||
);
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0024_3_0_0_alpha_9_2"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.9.3",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
33
api/libretime_api/legacy/migrations/0026_3_0_0_alpha_9_4.py
Normal file
33
api/libretime_api/legacy/migrations/0026_3_0_0_alpha_9_4.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
from django.db import migrations
|
||||
|
||||
from ._migrations import legacy_migration_factory
|
||||
|
||||
UP = """
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_id;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_code;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_error_msg;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_link_to_file;
|
||||
ALTER TABLE cc_files DROP COLUMN soundcloud_upload_time;
|
||||
"""
|
||||
|
||||
DOWN = """
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_id INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_code INTEGER;
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_error_msg VARCHAR(512);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_link_to_file VARCHAR(4096);
|
||||
ALTER TABLE cc_files ADD COLUMN soundcloud_upload_time TIMESTAMP(6);
|
||||
"""
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("legacy", "0025_3_0_0_alpha_9_3"),
|
||||
]
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
code=legacy_migration_factory(
|
||||
target="3.0.0-alpha.9.4",
|
||||
sql=UP,
|
||||
)
|
||||
)
|
||||
]
|
1
api/libretime_api/legacy/migrations/__init__.py
Normal file
1
api/libretime_api/legacy/migrations/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.9.4"
|
77
api/libretime_api/legacy/migrations/_migrations.py
Normal file
77
api/libretime_api/legacy/migrations/_migrations.py
Normal file
|
@ -0,0 +1,77 @@
|
|||
from typing import Callable, Optional
|
||||
|
||||
from django.db import connection
|
||||
|
||||
from ._version import parse_version
|
||||
|
||||
|
||||
def get_schema_version():
|
||||
"""
|
||||
Get the schema version from a legacy database.
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
if "cc_pref" not in connection.introspection.table_names():
|
||||
return None
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute("SELECT valstr FROM cc_pref WHERE keystr = 'schema_version'")
|
||||
row = cursor.fetchone()
|
||||
return row[0] if row else None
|
||||
|
||||
|
||||
def set_schema_version(cursor, version: str):
|
||||
cursor.execute(
|
||||
"""
|
||||
UPDATE cc_pref
|
||||
SET valstr = %s
|
||||
WHERE keystr = 'schema_version';
|
||||
""",
|
||||
[version],
|
||||
)
|
||||
if not cursor.rowcount:
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO cc_pref (keystr, valstr)
|
||||
VALUES ('schema_version', %s);
|
||||
""",
|
||||
[version],
|
||||
)
|
||||
|
||||
|
||||
def legacy_migration_factory(
|
||||
target: str,
|
||||
before: Optional[Callable] = None,
|
||||
sql: Optional[str] = None,
|
||||
after: Optional[Callable] = None,
|
||||
reverse: bool = False,
|
||||
):
|
||||
target_version = parse_version(target)
|
||||
|
||||
def inner(_apps, _schema_editor):
|
||||
current = get_schema_version()
|
||||
if current is None:
|
||||
raise Exception("current schema version was not found!")
|
||||
|
||||
current_version = parse_version(current)
|
||||
if current_version >= target_version and not reverse:
|
||||
return
|
||||
|
||||
if current_version < target_version and reverse:
|
||||
return
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
if before is not None:
|
||||
before(cursor)
|
||||
|
||||
if sql is not None:
|
||||
cursor.execute(sql)
|
||||
|
||||
if after is not None:
|
||||
after(cursor)
|
||||
|
||||
set_schema_version(cursor, version=target)
|
||||
|
||||
return inner
|
38
api/libretime_api/legacy/migrations/_version.py
Normal file
38
api/libretime_api/legacy/migrations/_version.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
import re
|
||||
|
||||
VERSION_RE = re.compile(
|
||||
r"""
|
||||
(?P<release>[0-9]+(?:\.[0-9]+)*)
|
||||
(?:
|
||||
-(?P<pre_l>(alpha|beta))
|
||||
(?:
|
||||
\.(?P<pre_n>[0-9]+
|
||||
(?:
|
||||
\.[0-9]+
|
||||
)?
|
||||
)
|
||||
)?
|
||||
)?
|
||||
""",
|
||||
re.VERBOSE | re.IGNORECASE,
|
||||
)
|
||||
|
||||
|
||||
def parse_version(version: str):
|
||||
match = VERSION_RE.search(version)
|
||||
if not match:
|
||||
raise Exception(f"invalid version {version}")
|
||||
|
||||
major, minor, patch = map(int, match.group("release").split("."))
|
||||
|
||||
pre_mapping = {"alpha": -2, "beta": -1, None: 0, "": 0}
|
||||
pre = pre_mapping[match.group("pre_l")]
|
||||
|
||||
pre_major, pre_minor = 0, 0
|
||||
pre_version = match.group("pre_n")
|
||||
if pre_version:
|
||||
pre_version_list = pre_version.split(".")
|
||||
pre_major = int(pre_version_list.pop(0)) if len(pre_version_list) else 0
|
||||
pre_minor = int(pre_version_list.pop(0)) if len(pre_version_list) else 0
|
||||
|
||||
return (major, minor, patch, pre, pre_major, pre_minor)
|
372
api/libretime_api/legacy/migrations/sql/data.sql
Normal file
372
api/libretime_api/legacy/migrations/sql/data.sql
Normal file
|
@ -0,0 +1,372 @@
|
|||
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
||||
-- added in 2.3
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('off_air_meta', 'LibreTime - offline', 'string');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('enable_replay_gain', 1);
|
||||
-- end of added in 2.3
|
||||
|
||||
-- added in 2.1
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('scheduled_play_switch', 'on');
|
||||
|
||||
INSERT INTO cc_live_log("state", "start_time") VALUES('S', now() at time zone 'UTC');
|
||||
-- end of added in 2.1
|
||||
|
||||
-- added in 2.0.0
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3, opus, aac');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device_type', 'ALSA', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_enable', 'true', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '127.0.0.1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'https://libretime.org', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_description', 'LibreTime Radio! Stream #1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_genre', 'genre', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_genre', '', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
|
||||
-- end of added in 2.0.0
|
||||
|
||||
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ALB', 'Albania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DZA', 'Algeria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ASM', 'American Samoa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AND', 'Andorra ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AGO', 'Angola ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AIA', 'Anguilla ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ATG', 'Antigua and Barbuda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARG', 'Argentina ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARM', 'Armenia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ABW', 'Aruba ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AUS', 'Australia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AUT', 'Austria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AZE', 'Azerbaijan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BHS', 'Bahamas ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BHR', 'Bahrain ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BGD', 'Bangladesh ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRB', 'Barbados ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLR', 'Belarus ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BEL', 'Belgium ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLZ', 'Belize ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BEN', 'Benin ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BMU', 'Bermuda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BTN', 'Bhutan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BOL', 'Bolivia (Plurinational State of) ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BES', 'Bonaire, Saint Eustatius and Saba');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BIH', 'Bosnia and Herzegovina ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BWA', 'Botswana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRA', 'Brazil ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VGB', 'British Virgin Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BRN', 'Brunei Darussalam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BGR', 'Bulgaria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BFA', 'Burkina Faso ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BDI', 'Burundi ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KHM', 'Cambodia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CMR', 'Cameroon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CAN', 'Canada ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CPV', 'Cape Verde ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CYM', 'Cayman Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CAF', 'Central African Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TCD', 'Chad ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHL', 'Chile ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHN', 'China ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HKG', 'China, Hong Kong Special Administrative Region');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAC', 'China, Macao Special Administrative Region');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COL', 'Colombia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COM', 'Comoros ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COG', 'Congo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COK', 'Cook Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CRI', 'Costa Rica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CIV', 'Côte d''Ivoire ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HRV', 'Croatia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CUB', 'Cuba ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CUW', 'Curaçao');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CYP', 'Cyprus ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CZE', 'Czech Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRK', 'Democratic People''s Republic of Korea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('COD', 'Democratic Republic of the Congo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DNK', 'Denmark ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DJI', 'Djibouti ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DMA', 'Dominica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DOM', 'Dominican Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ECU', 'Ecuador ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('EGY', 'Egypt ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLV', 'El Salvador ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GNQ', 'Equatorial Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ERI', 'Eritrea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('EST', 'Estonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ETH', 'Ethiopia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FRO', 'Faeroe Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FLK', 'Falkland Islands (Malvinas) ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FJI', 'Fiji ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FIN', 'Finland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FRA', 'France ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUF', 'French Guiana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PYF', 'French Polynesia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GAB', 'Gabon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GMB', 'Gambia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GEO', 'Georgia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('DEU', 'Germany ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GHA', 'Ghana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GIB', 'Gibraltar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRC', 'Greece ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRL', 'Greenland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GRD', 'Grenada ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GLP', 'Guadeloupe ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUM', 'Guam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GTM', 'Guatemala ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GGY', 'Guernsey');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GIN', 'Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GNB', 'Guinea-Bissau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GUY', 'Guyana ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HTI', 'Haiti ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VAT', 'Holy See ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HND', 'Honduras ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('HUN', 'Hungary ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ISL', 'Iceland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IND', 'India ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IDN', 'Indonesia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRN', 'Iran (Islamic Republic of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRQ', 'Iraq ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IRL', 'Ireland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('IMN', 'Isle of Man ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ISR', 'Israel ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ITA', 'Italy ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JAM', 'Jamaica ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JPN', 'Japan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JEY', 'Jersey');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('JOR', 'Jordan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KAZ', 'Kazakhstan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KEN', 'Kenya ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KIR', 'Kiribati ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KWT', 'Kuwait ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KGZ', 'Kyrgyzstan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LAO', 'Lao People''s Democratic Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LVA', 'Latvia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBN', 'Lebanon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LSO', 'Lesotho ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBR', 'Liberia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LBY', 'Libyan Arab Jamahiriya ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LIE', 'Liechtenstein ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LTU', 'Lithuania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LUX', 'Luxembourg ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDG', 'Madagascar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MWI', 'Malawi ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MYS', 'Malaysia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDV', 'Maldives ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MLI', 'Mali ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MLT', 'Malta ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MHL', 'Marshall Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MTQ', 'Martinique ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MRT', 'Mauritania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MUS', 'Mauritius ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MYT', 'Mayotte');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MEX', 'Mexico ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('FSM', 'Micronesia (Federated States of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MCO', 'Monaco ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNG', 'Mongolia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNE', 'Montenegro');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MSR', 'Montserrat ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAR', 'Morocco ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MOZ', 'Mozambique ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MMR', 'Myanmar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NAM', 'Namibia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NRU', 'Nauru ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NPL', 'Nepal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NLD', 'Netherlands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NCL', 'New Caledonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NZL', 'New Zealand ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NIC', 'Nicaragua ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NER', 'Niger ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NGA', 'Nigeria ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NIU', 'Niue ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NFK', 'Norfolk Island ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MNP', 'Northern Mariana Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('NOR', 'Norway ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PSE', 'Occupied Palestinian Territory ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('OMN', 'Oman ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PAK', 'Pakistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PLW', 'Palau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PAN', 'Panama ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PNG', 'Papua New Guinea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRY', 'Paraguay ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PER', 'Peru ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PHL', 'Philippines ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PCN', 'Pitcairn ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('POL', 'Poland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRT', 'Portugal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('PRI', 'Puerto Rico ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('QAT', 'Qatar ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KOR', 'Republic of Korea ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MDA', 'Republic of Moldova');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('REU', 'Réunion ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ROU', 'Romania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('RUS', 'Russian Federation ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('RWA', 'Rwanda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('BLM', 'Saint-Barthélemy');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SHN', 'Saint Helena ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('KNA', 'Saint Kitts and Nevis ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LCA', 'Saint Lucia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MAF', 'Saint-Martin (French part)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SPM', 'Saint Pierre and Miquelon ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VCT', 'Saint Vincent and the Grenadines ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('WSM', 'Samoa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SMR', 'San Marino ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('STP', 'Sao Tome and Principe ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SAU', 'Saudi Arabia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SEN', 'Senegal ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SRB', 'Serbia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SYC', 'Seychelles ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLE', 'Sierra Leone ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SGP', 'Singapore ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SXM', 'Sint Maarten (Dutch part)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SVK', 'Slovakia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SVN', 'Slovenia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SLB', 'Solomon Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SOM', 'Somalia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZAF', 'South Africa ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ESP', 'Spain ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('LKA', 'Sri Lanka ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SDN', 'Sudan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SUR', 'Suriname ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SJM', 'Svalbard and Jan Mayen Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SWZ', 'Swaziland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SWE', 'Sweden ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('CHE', 'Switzerland ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('SYR', 'Syrian Arab Republic ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TJK', 'Tajikistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('THA', 'Thailand ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('MKD', 'The former Yugoslav Republic of Macedonia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TLS', 'Timor-Leste');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TGO', 'Togo ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TKL', 'Tokelau ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TON', 'Tonga ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TTO', 'Trinidad and Tobago ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUN', 'Tunisia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUR', 'Turkey ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TKM', 'Turkmenistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TCA', 'Turks and Caicos Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TUV', 'Tuvalu ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UGA', 'Uganda ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UKR', 'Ukraine ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ARE', 'United Arab Emirates ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('GBR', 'United Kingdom of Great Britain and Northern Ireland');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('TZA', 'United Republic of Tanzania ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('USA', 'United States of America');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VIR', 'United States Virgin Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('URY', 'Uruguay ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('UZB', 'Uzbekistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VUT', 'Vanuatu ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VEN', 'Venezuela (Bolivarian Republic of)');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('VNM', 'Viet Nam ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('WLF', 'Wallis and Futuna Islands ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ESH', 'Western Sahara ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('YEM', 'Yemen ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZMB', 'Zambia ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ZWE', 'Zimbabwe ');
|
||||
|
||||
|
||||
-- added in 2.2
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_name', 'LibreTime!', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_name', '', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_name', '', 'string');
|
||||
|
||||
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_channels', 'stereo', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_channels', 'stereo', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_channels', 'stereo', 'string');
|
||||
-- end of added in 2.2
|
||||
|
||||
|
||||
-- added in 2.3
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('locale', 'en_CA');
|
||||
|
||||
INSERT INTO cc_pref("subjid", "keystr", "valstr") VALUES(1, 'user_locale', 'en_CA');
|
||||
|
||||
-- end of added in 2.3
|
||||
|
||||
-- added in 2.5.2
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', 'UTC');
|
||||
-- We don't want to set the user timezone by default - it should instead use the station timezone
|
||||
-- until the user changes it manually.
|
||||
-- INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_timezone', 'UTC');
|
||||
|
||||
INSERT INTO cc_pref (keystr, valstr) VALUES ('import_timestamp', '0');
|
||||
|
||||
--end added in 2.5.2
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_enable', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_name', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_admin_user', 'admin', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_admin_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s4_genre', '', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s4_channels', 'stereo', 'string');
|
||||
|
||||
-- added in 2.5.14 - this can't be set up in Propel's XML schema, so we need to do it here -- Duncan
|
||||
|
||||
ALTER TABLE cc_pref ALTER COLUMN subjid SET DEFAULT NULL;
|
||||
CREATE UNIQUE INDEX cc_pref_key_idx ON cc_pref (keystr) WHERE subjid IS NULL;
|
||||
ANALYZE cc_pref; -- this validates the new partial index
|
||||
|
||||
--end added in 2.5.14
|
||||
|
||||
-- For now, just needs to be truthy - to be updated later; we should find a better way to implement this...
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('whats_new_dialog_viewed', 1);
|
||||
|
||||
--added for LibreTime to turn on podcast album override by default 3.0.0.alpha6
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('podcast_album_override', 1);
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('podcast_auto_smartblock', 0);
|
||||
-- end
|
987
api/libretime_api/legacy/migrations/sql/schema.sql
Normal file
987
api/libretime_api/legacy/migrations/sql/schema.sql
Normal file
|
@ -0,0 +1,987 @@
|
|||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_music_dirs
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_music_dirs" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_music_dirs"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"directory" TEXT,
|
||||
"type" VARCHAR(255),
|
||||
"exists" BOOLEAN DEFAULT 't',
|
||||
"watched" BOOLEAN DEFAULT 't',
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_files
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_files" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_files"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mime" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"ftype" VARCHAR(128) DEFAULT '' NOT NULL,
|
||||
"directory" INTEGER,
|
||||
"filepath" TEXT DEFAULT '',
|
||||
"import_status" INTEGER DEFAULT 1 NOT NULL,
|
||||
"currentlyaccessing" INTEGER DEFAULT 0 NOT NULL,
|
||||
"editedby" INTEGER,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"lptime" TIMESTAMP(6),
|
||||
"md5" CHAR(32),
|
||||
"track_title" VARCHAR(512),
|
||||
"artist_name" VARCHAR(512),
|
||||
"bit_rate" INTEGER,
|
||||
"sample_rate" INTEGER,
|
||||
"format" VARCHAR(128),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
"album_title" VARCHAR(512),
|
||||
"genre" VARCHAR(64),
|
||||
"comments" TEXT,
|
||||
"year" VARCHAR(16),
|
||||
"track_number" INTEGER,
|
||||
"channels" INTEGER,
|
||||
"url" VARCHAR(1024),
|
||||
"bpm" INTEGER,
|
||||
"rating" VARCHAR(8),
|
||||
"encoded_by" VARCHAR(255),
|
||||
"disc_number" VARCHAR(8),
|
||||
"mood" VARCHAR(64),
|
||||
"label" VARCHAR(512),
|
||||
"composer" VARCHAR(512),
|
||||
"encoder" VARCHAR(64),
|
||||
"checksum" VARCHAR(256),
|
||||
"lyrics" TEXT,
|
||||
"orchestra" VARCHAR(512),
|
||||
"conductor" VARCHAR(512),
|
||||
"lyricist" VARCHAR(512),
|
||||
"original_lyricist" VARCHAR(512),
|
||||
"radio_station_name" VARCHAR(512),
|
||||
"info_url" VARCHAR(512),
|
||||
"artist_url" VARCHAR(512),
|
||||
"audio_source_url" VARCHAR(512),
|
||||
"radio_station_url" VARCHAR(512),
|
||||
"buy_this_url" VARCHAR(512),
|
||||
"isrc_number" VARCHAR(512),
|
||||
"catalog_number" VARCHAR(512),
|
||||
"original_artist" VARCHAR(512),
|
||||
"copyright" VARCHAR(512),
|
||||
"report_datetime" VARCHAR(32),
|
||||
"report_location" VARCHAR(512),
|
||||
"report_organization" VARCHAR(512),
|
||||
"subject" VARCHAR(512),
|
||||
"contributor" VARCHAR(512),
|
||||
"language" VARCHAR(512),
|
||||
"file_exists" BOOLEAN DEFAULT 't',
|
||||
"replay_gain" NUMERIC,
|
||||
"owner_id" INTEGER,
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"silan_check" BOOLEAN DEFAULT 'f',
|
||||
"hidden" BOOLEAN DEFAULT 'f',
|
||||
"is_scheduled" BOOLEAN DEFAULT 'f',
|
||||
"is_playlist" BOOLEAN DEFAULT 'f',
|
||||
"filesize" INTEGER DEFAULT 0 NOT NULL,
|
||||
"description" VARCHAR(512),
|
||||
"artwork" VARCHAR(512),
|
||||
"track_type" VARCHAR(16),
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_files_md5_idx" ON "cc_files" ("md5");
|
||||
|
||||
CREATE INDEX "cc_files_name_idx" ON "cc_files" ("name");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_track_types
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_track_types" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_track_types"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"code" VARCHAR(16) DEFAULT '' NOT NULL,
|
||||
"visibility" BOOLEAN DEFAULT 't' NOT NULL,
|
||||
"type_name" VARCHAR(64) DEFAULT '' NOT NULL,
|
||||
"description" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_track_types_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_track_types_code_idx" UNIQUE ("code")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cloud_file
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cloud_file" CASCADE;
|
||||
|
||||
CREATE TABLE "cloud_file"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"storage_backend" VARCHAR(512) NOT NULL,
|
||||
"resource_id" TEXT NOT NULL,
|
||||
"cc_file_id" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_perms
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_perms" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_perms"
|
||||
(
|
||||
"permid" INTEGER NOT NULL,
|
||||
"subj" INTEGER,
|
||||
"action" VARCHAR(20),
|
||||
"obj" INTEGER,
|
||||
"type" CHAR(1),
|
||||
PRIMARY KEY ("permid"),
|
||||
CONSTRAINT "cc_perms_all_idx" UNIQUE ("subj","action","obj"),
|
||||
CONSTRAINT "cc_perms_permid_idx" UNIQUE ("permid")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_perms_subj_obj_idx" ON "cc_perms" ("subj","obj");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"url" VARCHAR(255) DEFAULT '',
|
||||
"genre" VARCHAR(255) DEFAULT '',
|
||||
"description" VARCHAR(8192),
|
||||
"color" VARCHAR(6),
|
||||
"background_color" VARCHAR(6),
|
||||
"live_stream_using_airtime_auth" BOOLEAN DEFAULT 'f',
|
||||
"live_stream_using_custom_auth" BOOLEAN DEFAULT 'f',
|
||||
"live_stream_user" VARCHAR(255),
|
||||
"live_stream_pass" VARCHAR(255),
|
||||
"linked" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"is_linkable" BOOLEAN DEFAULT 't' NOT NULL,
|
||||
"image_path" VARCHAR(255) DEFAULT '',
|
||||
"has_autoplaylist" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"autoplaylist_id" INTEGER,
|
||||
"autoplaylist_repeat" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_instances
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_instances" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_instances"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"description" VARCHAR(8192) DEFAULT '',
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"record" INT2 DEFAULT 0,
|
||||
"rebroadcast" INT2 DEFAULT 0,
|
||||
"instance_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"time_filled" interval DEFAULT '00:00:00',
|
||||
"created" TIMESTAMP NOT NULL,
|
||||
"last_scheduled" TIMESTAMP,
|
||||
"modified_instance" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"autoplaylist_built" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_days
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_days" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_days"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"first_show" DATE NOT NULL,
|
||||
"last_show" DATE,
|
||||
"start_time" TIME NOT NULL,
|
||||
"timezone" VARCHAR NOT NULL,
|
||||
"duration" VARCHAR NOT NULL,
|
||||
"day" INT2,
|
||||
"repeat_type" INT2 NOT NULL,
|
||||
"next_pop_date" DATE,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"record" INT2 DEFAULT 0,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_rebroadcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_rebroadcast" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_rebroadcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"day_offset" VARCHAR NOT NULL,
|
||||
"start_time" TIME NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_show_hosts
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_show_hosts" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_show_hosts"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"show_id" INTEGER NOT NULL,
|
||||
"subjs_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playlist
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playlist" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playlist"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"creator_id" INTEGER,
|
||||
"description" VARCHAR(512),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playlistcontents
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playlistcontents" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playlistcontents"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"playlist_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"block_id" INTEGER,
|
||||
"stream_id" INTEGER,
|
||||
"type" INT2 DEFAULT 0 NOT NULL,
|
||||
"position" INTEGER,
|
||||
"trackoffset" FLOAT DEFAULT 0 NOT NULL,
|
||||
"cliplength" interval DEFAULT '00:00:00',
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"fadein" TIME DEFAULT '00:00:00',
|
||||
"fadeout" TIME DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_block
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_block" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_block"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"mtime" TIMESTAMP(6),
|
||||
"utime" TIMESTAMP(6),
|
||||
"creator_id" INTEGER,
|
||||
"description" VARCHAR(512),
|
||||
"length" interval DEFAULT '00:00:00',
|
||||
"type" VARCHAR(7) DEFAULT 'dynamic',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_blockcontents
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_blockcontents" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_blockcontents"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"block_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"position" INTEGER,
|
||||
"trackoffset" FLOAT DEFAULT 0 NOT NULL,
|
||||
"cliplength" interval DEFAULT '00:00:00',
|
||||
"cuein" interval DEFAULT '00:00:00',
|
||||
"cueout" interval DEFAULT '00:00:00',
|
||||
"fadein" TIME DEFAULT '00:00:00',
|
||||
"fadeout" TIME DEFAULT '00:00:00',
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_blockcriteria
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_blockcriteria" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_blockcriteria"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"criteria" VARCHAR(32) NOT NULL,
|
||||
"modifier" VARCHAR(16) NOT NULL,
|
||||
"value" VARCHAR(512) NOT NULL,
|
||||
"extra" VARCHAR(512),
|
||||
"criteriagroup" INTEGER,
|
||||
"block_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_pref
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_pref" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_pref"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"subjid" INTEGER,
|
||||
"keystr" VARCHAR(255),
|
||||
"valstr" TEXT,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_pref_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_pref_subj_key_idx" UNIQUE ("subjid","keystr")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_pref_subjid_idx" ON "cc_pref" ("subjid");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_schedule
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_schedule" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_schedule"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"stream_id" INTEGER,
|
||||
"clip_length" interval DEFAULT '00:00:00',
|
||||
"fade_in" TIME DEFAULT '00:00:00',
|
||||
"fade_out" TIME DEFAULT '00:00:00',
|
||||
"cue_in" interval NOT NULL,
|
||||
"cue_out" interval NOT NULL,
|
||||
"media_item_played" BOOLEAN DEFAULT 'f',
|
||||
"instance_id" INTEGER NOT NULL,
|
||||
"playout_status" INT2 DEFAULT 1 NOT NULL,
|
||||
"broadcasted" INT2 DEFAULT 0 NOT NULL,
|
||||
"position" INTEGER DEFAULT 0 NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_schedule_instance_id_idx" ON "cc_schedule" ("instance_id");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_sess
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_sess" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_sess"
|
||||
(
|
||||
"sessid" CHAR(32) NOT NULL,
|
||||
"userid" INTEGER,
|
||||
"login" VARCHAR(255),
|
||||
"ts" TIMESTAMP,
|
||||
PRIMARY KEY ("sessid")
|
||||
);
|
||||
|
||||
CREATE INDEX "cc_sess_login_idx" ON "cc_sess" ("login");
|
||||
|
||||
CREATE INDEX "cc_sess_userid_idx" ON "cc_sess" ("userid");
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_subjs
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_subjs" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_subjs"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"login" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"pass" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"type" CHAR(1) DEFAULT 'U' NOT NULL,
|
||||
"first_name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"last_name" VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
"lastlogin" TIMESTAMP,
|
||||
"lastfail" TIMESTAMP,
|
||||
"skype_contact" VARCHAR,
|
||||
"jabber_contact" VARCHAR,
|
||||
"email" VARCHAR,
|
||||
"cell_phone" VARCHAR,
|
||||
"login_attempts" INTEGER DEFAULT 0,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"),
|
||||
CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_subjs_token
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_subjs_token" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_subjs_token"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"user_id" INTEGER NOT NULL,
|
||||
"action" VARCHAR(255) NOT NULL,
|
||||
"token" VARCHAR(40) NOT NULL,
|
||||
"created" TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_subjs_token_idx" UNIQUE ("token")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_country
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_country" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_country"
|
||||
(
|
||||
"isocode" CHAR(3) NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
PRIMARY KEY ("isocode")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_stream_setting
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_stream_setting" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_stream_setting"
|
||||
(
|
||||
"keyname" VARCHAR(64) NOT NULL,
|
||||
"value" VARCHAR(255),
|
||||
"type" VARCHAR(16) NOT NULL,
|
||||
PRIMARY KEY ("keyname")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_login_attempts
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_login_attempts" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_login_attempts"
|
||||
(
|
||||
"ip" VARCHAR(32) NOT NULL,
|
||||
"attempts" INTEGER DEFAULT 0,
|
||||
PRIMARY KEY ("ip")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_service_register
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_service_register" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_service_register"
|
||||
(
|
||||
"name" VARCHAR(32) NOT NULL,
|
||||
"ip" VARCHAR(45) NOT NULL,
|
||||
PRIMARY KEY ("name")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_live_log
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_live_log" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_live_log"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"state" VARCHAR(32) NOT NULL,
|
||||
"start_time" TIMESTAMP NOT NULL,
|
||||
"end_time" TIMESTAMP,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_webstream
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_webstream" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_webstream"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(255) NOT NULL,
|
||||
"description" VARCHAR(255) NOT NULL,
|
||||
"url" VARCHAR(512) NOT NULL,
|
||||
"length" interval DEFAULT '00:00:00' NOT NULL,
|
||||
"creator_id" INTEGER NOT NULL,
|
||||
"mtime" TIMESTAMP(6) NOT NULL,
|
||||
"utime" TIMESTAMP(6) NOT NULL,
|
||||
"lptime" TIMESTAMP(6),
|
||||
"mime" VARCHAR,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_webstream_metadata
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_webstream_metadata" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_webstream_metadata"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"instance_id" INTEGER NOT NULL,
|
||||
"start_time" TIMESTAMP NOT NULL,
|
||||
"liquidsoap_data" VARCHAR(1024) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_mount_name
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_mount_name" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_mount_name"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"mount_name" VARCHAR NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_timestamp
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_timestamp" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_timestamp"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"timestamp" TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_listener_count
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_listener_count" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_listener_count"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"timestamp_id" INTEGER NOT NULL,
|
||||
"mount_name_id" INTEGER NOT NULL,
|
||||
"listener_count" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"starts" TIMESTAMP NOT NULL,
|
||||
"ends" TIMESTAMP,
|
||||
"instance_id" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_metadata
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_metadata" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_metadata"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"history_id" INTEGER NOT NULL,
|
||||
"key" VARCHAR(128) NOT NULL,
|
||||
"value" VARCHAR(128) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_template
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_template" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_template"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"name" VARCHAR(128) NOT NULL,
|
||||
"type" VARCHAR(35) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- cc_playout_history_template_field
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "cc_playout_history_template_field" CASCADE;
|
||||
|
||||
CREATE TABLE "cc_playout_history_template_field"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"template_id" INTEGER NOT NULL,
|
||||
"name" VARCHAR(128) NOT NULL,
|
||||
"label" VARCHAR(128) NOT NULL,
|
||||
"type" VARCHAR(128) NOT NULL,
|
||||
"is_file_md" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"position" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- third_party_track_references
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "third_party_track_references" CASCADE;
|
||||
|
||||
CREATE TABLE "third_party_track_references"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"service" VARCHAR(256) NOT NULL,
|
||||
"foreign_id" VARCHAR(256),
|
||||
"file_id" INTEGER DEFAULT 0 NOT NULL,
|
||||
"upload_time" TIMESTAMP,
|
||||
"status" VARCHAR(256),
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "foreign_id_unique" UNIQUE ("foreign_id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- celery_tasks
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "celery_tasks" CASCADE;
|
||||
|
||||
CREATE TABLE "celery_tasks"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"task_id" VARCHAR(256) NOT NULL,
|
||||
"track_reference" INTEGER NOT NULL,
|
||||
"name" VARCHAR(256),
|
||||
"dispatch_time" TIMESTAMP,
|
||||
"status" VARCHAR(256) NOT NULL,
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "id_unique" UNIQUE ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"url" VARCHAR(4096) NOT NULL,
|
||||
"title" VARCHAR(4096) NOT NULL,
|
||||
"creator" VARCHAR(4096),
|
||||
"description" VARCHAR(4096),
|
||||
"language" VARCHAR(4096),
|
||||
"copyright" VARCHAR(4096),
|
||||
"link" VARCHAR(4096),
|
||||
"itunes_author" VARCHAR(4096),
|
||||
"itunes_keywords" VARCHAR(4096),
|
||||
"itunes_summary" VARCHAR(4096),
|
||||
"itunes_subtitle" VARCHAR(4096),
|
||||
"itunes_category" VARCHAR(4096),
|
||||
"itunes_explicit" VARCHAR(4096),
|
||||
"owner" INTEGER,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- station_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "station_podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "station_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- imported_podcast
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "imported_podcast" CASCADE;
|
||||
|
||||
CREATE TABLE "imported_podcast"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"auto_ingest" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"auto_ingest_timestamp" TIMESTAMP,
|
||||
"album_override" BOOLEAN DEFAULT 'f' NOT NULL,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
-- podcast_episodes
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS "podcast_episodes" CASCADE;
|
||||
|
||||
CREATE TABLE "podcast_episodes"
|
||||
(
|
||||
"id" serial NOT NULL,
|
||||
"file_id" INTEGER,
|
||||
"podcast_id" INTEGER NOT NULL,
|
||||
"publication_date" TIMESTAMP NOT NULL,
|
||||
"download_url" VARCHAR(4096) NOT NULL,
|
||||
"episode_guid" VARCHAR(4096) NOT NULL,
|
||||
"episode_title" VARCHAR(4096) NOT NULL,
|
||||
"episode_description" TEXT NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_owner_fkey"
|
||||
FOREIGN KEY ("owner_id")
|
||||
REFERENCES "cc_subjs" ("id");
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey"
|
||||
FOREIGN KEY ("editedby")
|
||||
REFERENCES "cc_subjs" ("id");
|
||||
|
||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
|
||||
FOREIGN KEY ("directory")
|
||||
REFERENCES "cc_music_dirs" ("id");
|
||||
|
||||
ALTER TABLE "cloud_file" ADD CONSTRAINT "cloud_file_FK_1"
|
||||
FOREIGN KEY ("cc_file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey"
|
||||
FOREIGN KEY ("subj")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show" ADD CONSTRAINT "cc_playlist_autoplaylist_fkey"
|
||||
FOREIGN KEY ("autoplaylist_id")
|
||||
REFERENCES "cc_playlist" ("id")
|
||||
ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_original_show_instance_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_recorded_file_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_days" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_rebroadcast" ADD CONSTRAINT "cc_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_show_fkey"
|
||||
FOREIGN KEY ("show_id")
|
||||
REFERENCES "cc_show" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_show_hosts" ADD CONSTRAINT "cc_perm_host_fkey"
|
||||
FOREIGN KEY ("subjs_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlist" ADD CONSTRAINT "cc_playlist_createdby_fkey"
|
||||
FOREIGN KEY ("creator_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_file_id_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey"
|
||||
FOREIGN KEY ("playlist_id")
|
||||
REFERENCES "cc_playlist" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey"
|
||||
FOREIGN KEY ("creator_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcriteria" ADD CONSTRAINT "cc_blockcontents_block_id_fkey"
|
||||
FOREIGN KEY ("block_id")
|
||||
REFERENCES "cc_block" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey"
|
||||
FOREIGN KEY ("subjid")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey"
|
||||
FOREIGN KEY ("stream_id")
|
||||
REFERENCES "cc_webstream" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey"
|
||||
FOREIGN KEY ("userid")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey"
|
||||
FOREIGN KEY ("user_id")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_webstream_metadata" ADD CONSTRAINT "cc_schedule_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_schedule" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_timestamp_inst_fkey"
|
||||
FOREIGN KEY ("timestamp_id")
|
||||
REFERENCES "cc_timestamp" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_listener_count" ADD CONSTRAINT "cc_mount_name_inst_fkey"
|
||||
FOREIGN KEY ("mount_name_id")
|
||||
REFERENCES "cc_mount_name" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_playout_history_file_tag_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history" ADD CONSTRAINT "cc_his_item_inst_fkey"
|
||||
FOREIGN KEY ("instance_id")
|
||||
REFERENCES "cc_show_instances" ("id")
|
||||
ON DELETE SET NULL;
|
||||
|
||||
ALTER TABLE "cc_playout_history_metadata" ADD CONSTRAINT "cc_playout_history_metadata_entry_fkey"
|
||||
FOREIGN KEY ("history_id")
|
||||
REFERENCES "cc_playout_history" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_playout_history_template_field" ADD CONSTRAINT "cc_playout_history_template_template_fkey"
|
||||
FOREIGN KEY ("template_id")
|
||||
REFERENCES "cc_playout_history_template" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "third_party_track_references" ADD CONSTRAINT "track_reference_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "celery_tasks" ADD CONSTRAINT "celery_service_fkey"
|
||||
FOREIGN KEY ("track_reference")
|
||||
REFERENCES "third_party_track_references" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast" ADD CONSTRAINT "podcast_owner_fkey"
|
||||
FOREIGN KEY ("owner")
|
||||
REFERENCES "cc_subjs" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "station_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "imported_podcast" ADD CONSTRAINT "podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_cc_files_fkey"
|
||||
FOREIGN KEY ("file_id")
|
||||
REFERENCES "cc_files" ("id")
|
||||
ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "podcast_episodes" ADD CONSTRAINT "podcast_episodes_podcast_id_fkey"
|
||||
FOREIGN KEY ("podcast_id")
|
||||
REFERENCES "podcast" ("id")
|
||||
ON DELETE CASCADE;
|
2
api/libretime_api/legacy/migrations/sql/sqldb.map
Normal file
2
api/libretime_api/legacy/migrations/sql/sqldb.map
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Sqlfile -> Database map
|
||||
schema.sql=airtime
|
0
api/libretime_api/legacy/tests/__init__.py
Normal file
0
api/libretime_api/legacy/tests/__init__.py
Normal file
0
api/libretime_api/legacy/tests/migrations/__init__.py
Normal file
0
api/libretime_api/legacy/tests/migrations/__init__.py
Normal file
44
api/libretime_api/legacy/tests/migrations/test_version.py
Normal file
44
api/libretime_api/legacy/tests/migrations/test_version.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
import pytest
|
||||
|
||||
from ...migrations._version import parse_version
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"version,expected",
|
||||
[
|
||||
# fmt: off
|
||||
("3.0.0-alpha", (3, 0, 0, -2, 0, 0)),
|
||||
("3.1.0-alpha.1", (3, 1, 0, -2, 1, 0)),
|
||||
("3.0.1-alpha.1.2", (3, 0, 1, -2, 1, 2)),
|
||||
("3.0.0-beta", (3, 0, 0, -1, 0, 0)),
|
||||
("3.0.0-beta.10", (3, 0, 0, -1, 10, 0)),
|
||||
("2.5.2", (2, 5, 2, 0, 0, 0)),
|
||||
("3.0.0", (3, 0, 0, 0, 0, 0)),
|
||||
# fmt: on
|
||||
],
|
||||
)
|
||||
def test_parse_version(version: str, expected):
|
||||
assert parse_version(version) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"before,after",
|
||||
[
|
||||
# fmt: off
|
||||
("3.0.0-alpha", "3.0.0-alpha.1"),
|
||||
("3.0.0-alpha.1", "3.0.0-alpha.2"),
|
||||
("3.0.0-alpha.1", "3.0.0-alpha.1.1"),
|
||||
("3.0.0-alpha", "3.0.0-beta"),
|
||||
("3.0.0-beta", "3.0.0"),
|
||||
("3.0.0", "3.0.1"),
|
||||
("3.0.0", "3.1.0"),
|
||||
("3.0.0", "4.0.0"),
|
||||
("2.5.3", "3.0.0"),
|
||||
("3.0.0", "3.0.0"),
|
||||
# fmt: on
|
||||
],
|
||||
)
|
||||
def test_version_compare(before: str, after: str):
|
||||
version_before = parse_version(before)
|
||||
version_after = parse_version(after)
|
||||
assert version_before <= version_after
|
|
@ -9,6 +9,7 @@ DEBUG = getenv("LIBRETIME_DEBUG", "false").lower() == "true"
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"libretime_api.legacy",
|
||||
"libretime_api.core",
|
||||
"libretime_api.history",
|
||||
"libretime_api.storage",
|
||||
|
|
|
@ -21,6 +21,9 @@ setup(
|
|||
},
|
||||
license="AGPLv3",
|
||||
packages=find_packages(),
|
||||
package_data={
|
||||
"libretime_api": ["legacy/migrations/sql/*.sql"],
|
||||
},
|
||||
include_package_data=True,
|
||||
python_requires=">=3.6",
|
||||
entry_points={
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue