From d184802130286c06b263b4131fb7ddbfcca09e91 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 9 Jul 2017 15:47:57 -0700 Subject: [PATCH] Added playlists tables --- .../201707091522_playlists_tables/down.sql | 2 ++ .../201707091522_playlists_tables/up.sql | 17 +++++++++++++++++ src/db/schema.sqlite | Bin 53248 -> 69632 bytes 3 files changed, 19 insertions(+) create mode 100644 src/db/migrations/201707091522_playlists_tables/down.sql create mode 100644 src/db/migrations/201707091522_playlists_tables/up.sql diff --git a/src/db/migrations/201707091522_playlists_tables/down.sql b/src/db/migrations/201707091522_playlists_tables/down.sql new file mode 100644 index 0000000..8060d04 --- /dev/null +++ b/src/db/migrations/201707091522_playlists_tables/down.sql @@ -0,0 +1,2 @@ +DROP TABLE playlists; +DROP TABLE playlist_songs; diff --git a/src/db/migrations/201707091522_playlists_tables/up.sql b/src/db/migrations/201707091522_playlists_tables/up.sql new file mode 100644 index 0000000..bfa0723 --- /dev/null +++ b/src/db/migrations/201707091522_playlists_tables/up.sql @@ -0,0 +1,17 @@ +CREATE TABLE playlists ( + id INTEGER PRIMARY KEY NOT NULL, + owner INTEGER NOT NULL, + name TEXT NOT NULL, + FOREIGN KEY(owner) REFERENCES users(id) ON DELETE CASCADE, + UNIQUE(owner, name) +); + +CREATE TABLE playlist_songs ( + id INTEGER PRIMARY KEY NOT NULL, + 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) +); diff --git a/src/db/schema.sqlite b/src/db/schema.sqlite index eabf4acb1a4d4681a879864d45c34514818a3a8d..84aa6e454b1627399e1f85303fca1c9b19234094 100644 GIT binary patch delta 1004 zcmah{&ui0A9B*ycY?b77UaA$%TSaK3vX_^p$(uWvA1||7QtUdxgUrgx9M-lp9pYu1 zKTbPYA~@K=;n|Dy;>Eu}5WNq*c~iuj7cr^Lvf{vy@bb;~^ZD@ke8|>bY-=z6jAy4K z;g#&?=VPgfjsCq;lgw%M{CV?*9`Fd3o5X-*5O) z2EUmX6R}ui-rZplmjH?3A0l#zH0Aw(XM#XZn9Tv48JYBfgX7$<=m`eIBVZrA1;ZRo zc4~4Ii5cw9zHe_@NEJ<4Bt;PsQcw(2R3#)4ObAs?BFhR@Ri&WFvW}>zs>sqLSymNE zq`HAb4N;Hgp-8b%)OGKav7t+bUNDPA!_qWbpc0{`qKKBPVO^DELzb|i5!KW!Vxp)u M`1&$~UZKl>0FXWo^T7KILq_wJIsm*SF_yf<}n@Jl$@O>nWBt0jU$2m1ls zvbgvO1V2H+&DqtZ7#AbxaR>iD{Q2G8WWG9?yElHj?NqfsJveqZ8q4X~PSNXJHi~8A zZq3b{i~PQg`DrUHTAQD>P8|jgEZ_-lVGJV}6us^??DgyJJ`)Ow5lP~5N_~iBbC-A+ z#zVpR$oHB*mh!Rhom95({w4^D{}QObQe{FUQvYP~h41ZF*k<`)9cB)Ez#F{6Gd#kq z*urZlW=AjQS4o)Kh^#Onr8+`FP68=IOiUaEf