feat: move storage path setting to configuration file

- change default storage path to /srv/libretime
- remove music dirs table
- use /tmp for testing storage
- storage dir should always have a trailing slash
This commit is contained in:
jo 2022-04-18 20:34:38 +02:00 committed by Kyle Robbertze
parent b3ff2defc4
commit f7bb6e7592
48 changed files with 464 additions and 4701 deletions

View file

@ -0,0 +1,41 @@
from django.db import migrations
from ._migrations import legacy_migration_factory
UP = """
ALTER TABLE "cc_files" DROP CONSTRAINT "cc_music_dirs_folder_fkey";
ALTER TABLE "cc_files" DROP COLUMN "directory";
DROP TABLE "cc_music_dirs";
"""
DOWN = """
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")
);
ALTER TABLE "cc_files" ADD COLUMN "directory" INTEGER;
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey"
FOREIGN KEY ("directory")
REFERENCES "cc_music_dirs" ("id");
"""
class Migration(migrations.Migration):
dependencies = [
("legacy", "0028_3_0_0_alpha_13_2"),
]
operations = [
migrations.RunPython(
code=legacy_migration_factory(
target="3.0.0-alpha.13.3",
sql=UP,
)
)
]

View file

@ -1 +1 @@
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.2"
LEGACY_SCHEMA_VERSION = "3.0.0-alpha.13.3"

View file

@ -1,21 +1,4 @@
-----------------------------------------------------------------------
-- 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
-----------------------------------------------------------------------
@ -28,7 +11,6 @@ CREATE TABLE "cc_files"
"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,
@ -792,10 +774,6 @@ 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")