Multiple accounts support, load tags online
This commit is contained in:
parent
cd2827791f
commit
26ea869285
14 changed files with 295 additions and 124 deletions
|
@ -1,6 +1,14 @@
|
|||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE account (
|
||||
account TEXT NOT NULL,
|
||||
fan_id INTEGER NOT NULL,
|
||||
currency TEXT,
|
||||
PRIMARY KEY (account)
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE item (
|
||||
account TEXT NOT NULL,
|
||||
item_id INTEGER NOT NULL,
|
||||
item_type TEXT NOT NULL,
|
||||
band_id INTEGER NOT NULL,
|
||||
|
@ -24,10 +32,11 @@ CREATE TABLE item (
|
|||
currency STRING NOT NULL,
|
||||
label TEXT,
|
||||
label_id INTEGER,
|
||||
PRIMARY KEY (item_id)
|
||||
PRIMARY KEY (account, item_id)
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE track (
|
||||
account TEXT NOT NULL,
|
||||
item_id INTEGER NOT NULL,
|
||||
track_id INTEGER NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
|
@ -35,15 +44,16 @@ CREATE TABLE track (
|
|||
track_number INTEGER,
|
||||
duration NUMERIC NOT NULL,
|
||||
mp3 TEXT,
|
||||
PRIMARY KEY (item_id, track_id),
|
||||
FOREIGN KEY (item_id) REFERENCES item (item_id) ON DELETE CASCADE
|
||||
PRIMARY KEY (account, item_id, track_id),
|
||||
FOREIGN KEY (account, item_id) REFERENCES item (account, item_id) ON DELETE CASCADE
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE item_tag (
|
||||
account TEXT NOT NULL,
|
||||
item_id INTEGER NOT NULL,
|
||||
tag TEXT NOT NULL,
|
||||
PRIMARY KEY (item_id, tag),
|
||||
FOREIGN KEY (item_id) REFERENCES item (item_id) ON DELETE CASCADE
|
||||
PRIMARY KEY (account, item_id, tag),
|
||||
FOREIGN KEY (account, item_id) REFERENCES item (account, item_id) ON DELETE CASCADE
|
||||
) WITHOUT ROWID;
|
||||
|
||||
COMMIT;
|
||||
|
|
9
db/orm-defs.d.ts
vendored
9
db/orm-defs.d.ts
vendored
|
@ -1,5 +1,12 @@
|
|||
export type Models = {
|
||||
account: {
|
||||
account: string
|
||||
fan_id: number
|
||||
currency: string | null
|
||||
}
|
||||
|
||||
item: {
|
||||
account: string
|
||||
item_id: number
|
||||
item_type: string
|
||||
band_id: number
|
||||
|
@ -26,6 +33,7 @@ export type Models = {
|
|||
}
|
||||
|
||||
track: {
|
||||
account: string
|
||||
item_id: number
|
||||
track_id: number
|
||||
title: string
|
||||
|
@ -36,6 +44,7 @@ export type Models = {
|
|||
}
|
||||
|
||||
item_tag: {
|
||||
account: string
|
||||
item_id: number
|
||||
tag: string
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue