Added conflict clauses
This commit is contained in:
parent
c5f3bf44e4
commit
9ae77d6903
1 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,7 @@ CREATE TABLE playlists (
|
|||
owner INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
FOREIGN KEY(owner) REFERENCES users(id) ON DELETE CASCADE,
|
||||
UNIQUE(owner, name)
|
||||
UNIQUE(owner, name) ON CONFLICT REPLACE
|
||||
);
|
||||
|
||||
CREATE TABLE playlist_songs (
|
||||
|
@ -11,7 +11,7 @@ CREATE TABLE playlist_songs (
|
|||
playlist INTEGER NOT NULL,
|
||||
path TEXT NOT NULL,
|
||||
ordering INTEGER NOT NULL,
|
||||
FOREIGN KEY(path) REFERENCES songs(path) ON DELETE NO ACTION,
|
||||
FOREIGN KEY(playlist) REFERENCES playlists(id) ON DELETE CASCADE,
|
||||
UNIQUE(playlist, ordering)
|
||||
FOREIGN KEY(path) REFERENCES songs(path),
|
||||
FOREIGN KEY(playlist) REFERENCES playlists(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
UNIQUE(playlist, ordering) ON CONFLICT REPLACE
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue