mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Ignore case for artists, albums, tracks and folder names, regardless of the DB
Closes #41
This commit is contained in:
parent
ecba5826b4
commit
efbe0d4a4b
@ -74,7 +74,12 @@ _MySQL_-compatible or _PostgreSQL_ database.
|
|||||||
_Supysonic_ does not automatically create the database and tables it needs to
|
_Supysonic_ does not automatically create the database and tables it needs to
|
||||||
work. Thus the database and tables must be created prior to running the
|
work. Thus the database and tables must be created prior to running the
|
||||||
application. Please refer to the documentation of the DBMS you've chosen on how
|
application. Please refer to the documentation of the DBMS you've chosen on how
|
||||||
to create a database and how to use a command-line client.
|
to create a database and how to use a command-line client. If you want to use
|
||||||
|
_PostgreSQL_ you'll have to add the `citext` extension to the database once
|
||||||
|
created. This can be done when connected to the database as the superuser with
|
||||||
|
the folowing SQL command:
|
||||||
|
|
||||||
|
supysonic=# CREATE EXTENSION citext;
|
||||||
|
|
||||||
Table creation scripts are provided in the `schema` folder for _SQLite_,
|
Table creation scripts are provided in the `schema` folder for _SQLite_,
|
||||||
_MySQL_ and _PostgreSQL_. Just feed them to any client you're able to use.
|
_MySQL_ and _PostgreSQL_. Just feed them to any client you're able to use.
|
||||||
|
9
schema/migration/20180311.postgresql.sql
Normal file
9
schema/migration/20180311.postgresql.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE folder ALTER COLUMN name TYPE CITEXT;
|
||||||
|
ALTER TABLE artist ALTER COLUMN name TYPE CITEXT;
|
||||||
|
ALTER TABLE album ALTER COLUMN name TYPE CITEXT;
|
||||||
|
ALTER TABLE track ALTER COLUMN title TYPE CITEXT;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
52
schema/migration/20180311.sqlite.sql
Normal file
52
schema/migration/20180311.sqlite.sql
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE folder RENAME TO folder_old;
|
||||||
|
ALTER TABLE track RENAME TO track_old;
|
||||||
|
|
||||||
|
CREATE TABLE folder (
|
||||||
|
id CHAR(36) PRIMARY KEY,
|
||||||
|
root BOOLEAN NOT NULL,
|
||||||
|
name VARCHAR(256) NOT NULL COLLATE NOCASE,
|
||||||
|
path VARCHAR(4096) NOT NULL,
|
||||||
|
created DATETIME NOT NULL,
|
||||||
|
has_cover_art BOOLEAN NOT NULL,
|
||||||
|
last_scan INTEGER NOT NULL,
|
||||||
|
parent_id CHAR(36) REFERENCES folder
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE track (
|
||||||
|
id CHAR(36) PRIMARY KEY,
|
||||||
|
disc INTEGER NOT NULL,
|
||||||
|
number INTEGER NOT NULL,
|
||||||
|
title VARCHAR(256) NOT NULL COLLATE NOCASE,
|
||||||
|
year INTEGER,
|
||||||
|
genre VARCHAR(256),
|
||||||
|
duration INTEGER NOT NULL,
|
||||||
|
album_id CHAR(36) NOT NULL REFERENCES album,
|
||||||
|
artist_id CHAR(36) NOT NULL REFERENCES artist,
|
||||||
|
bitrate INTEGER NOT NULL,
|
||||||
|
path VARCHAR(4096) NOT NULL,
|
||||||
|
content_type VARCHAR(32) NOT NULL,
|
||||||
|
created DATETIME NOT NULL,
|
||||||
|
last_modification INTEGER NOT NULL,
|
||||||
|
play_count INTEGER NOT NULL,
|
||||||
|
last_play DATETIME,
|
||||||
|
root_folder_id CHAR(36) NOT NULL REFERENCES folder,
|
||||||
|
folder_id CHAR(36) NOT NULL REFERENCES folder
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO folder (id, root, name, path, created, has_cover_art, last_scan, parent_id)
|
||||||
|
SELECT id, root, name, path, created, has_cover_art, last_scan, parent_id
|
||||||
|
FROM folder_old;
|
||||||
|
|
||||||
|
INSERT INTO track(id, disc, number, title, year, genre, duration, album_id, artist_id, bitrate, path, content_type, created, last_modification, play_count, last_play, root_folder_id, folder_id)
|
||||||
|
SELECT id, disc, number, title, year, genre, duration, album_id, artist_id, bitrate, path, content_type, created, last_modification, play_count, last_play, root_folder_id, folder_id
|
||||||
|
FROM track_old;
|
||||||
|
|
||||||
|
DROP TABLE folder_old;
|
||||||
|
DROP TABLE track_old;
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
VACUUM;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
CREATE TABLE folder (
|
CREATE TABLE folder (
|
||||||
id UUID PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
root BOOLEAN NOT NULL,
|
root BOOLEAN NOT NULL,
|
||||||
name VARCHAR(256) NOT NULL,
|
name CITEXT NOT NULL,
|
||||||
path VARCHAR(4096) NOT NULL,
|
path VARCHAR(4096) NOT NULL,
|
||||||
created TIMESTAMP NOT NULL,
|
created TIMESTAMP NOT NULL,
|
||||||
has_cover_art BOOLEAN NOT NULL,
|
has_cover_art BOOLEAN NOT NULL,
|
||||||
@ -11,12 +11,12 @@ CREATE TABLE folder (
|
|||||||
|
|
||||||
CREATE TABLE artist (
|
CREATE TABLE artist (
|
||||||
id UUID PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
name VARCHAR(256) NOT NULL
|
name CITEXT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE album (
|
CREATE TABLE album (
|
||||||
id UUID PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
name VARCHAR(256) NOT NULL,
|
name CITEXT NOT NULL,
|
||||||
artist_id UUID NOT NULL REFERENCES artist
|
artist_id UUID NOT NULL REFERENCES artist
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ CREATE TABLE track (
|
|||||||
id UUID PRIMARY KEY,
|
id UUID PRIMARY KEY,
|
||||||
disc INTEGER NOT NULL,
|
disc INTEGER NOT NULL,
|
||||||
number INTEGER NOT NULL,
|
number INTEGER NOT NULL,
|
||||||
title VARCHAR(256) NOT NULL,
|
title CITEXT NOT NULL,
|
||||||
year INTEGER,
|
year INTEGER,
|
||||||
genre VARCHAR(256),
|
genre VARCHAR(256),
|
||||||
duration INTEGER NOT NULL,
|
duration INTEGER NOT NULL,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
CREATE TABLE folder (
|
CREATE TABLE folder (
|
||||||
id CHAR(36) PRIMARY KEY,
|
id CHAR(36) PRIMARY KEY,
|
||||||
root BOOLEAN NOT NULL,
|
root BOOLEAN NOT NULL,
|
||||||
name VARCHAR(256) NOT NULL,
|
name VARCHAR(256) NOT NULL COLLATE NOCASE,
|
||||||
path VARCHAR(4096) NOT NULL,
|
path VARCHAR(4096) NOT NULL,
|
||||||
created DATETIME NOT NULL,
|
created DATETIME NOT NULL,
|
||||||
has_cover_art BOOLEAN NOT NULL,
|
has_cover_art BOOLEAN NOT NULL,
|
||||||
@ -24,7 +24,7 @@ CREATE TABLE track (
|
|||||||
id CHAR(36) PRIMARY KEY,
|
id CHAR(36) PRIMARY KEY,
|
||||||
disc INTEGER NOT NULL,
|
disc INTEGER NOT NULL,
|
||||||
number INTEGER NOT NULL,
|
number INTEGER NOT NULL,
|
||||||
title VARCHAR(256) NOT NULL,
|
title VARCHAR(256) NOT NULL COLLATE NOCASE,
|
||||||
year INTEGER,
|
year INTEGER,
|
||||||
genre VARCHAR(256),
|
genre VARCHAR(256),
|
||||||
duration INTEGER NOT NULL,
|
duration INTEGER NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user