summaryrefslogtreecommitdiff
path: root/init.postgresql.sql
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-01-04 02:10:27 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2011-01-04 02:10:27 +0100
commitb73c8b20a034a4e8ac9ab8740453e35160c20833 (patch)
tree350302168da233ddc1eed20ee4bc4ca1fa2c9467 /init.postgresql.sql
parent8149e0487f6e658af71339f41a4f2f8413876cf0 (diff)
Implemented music::update(), needs some work to make queries work on different engines.
Diffstat (limited to 'init.postgresql.sql')
-rw-r--r--init.postgresql.sql31
1 files changed, 31 insertions, 0 deletions
diff --git a/init.postgresql.sql b/init.postgresql.sql
new file mode 100644
index 0000000..96ddca5
--- /dev/null
+++ b/init.postgresql.sql
@@ -0,0 +1,31 @@
+BEGIN;
+
+CREATE SEQUENCE artists_id_seq;
+CREATE TABLE artists (
+ id INTEGER PRIMARY KEY DEFAULT nextval('artists_id_seq'),
+ name VARCHAR UNIQUE);
+ALTER SEQUENCE artists_id_seq OWNED BY artists.id;
+
+CREATE SEQUENCE albums_id_seq;
+CREATE TABLE albums (
+ id INTEGER PRIMARY KEY DEFAULT nextval('albums_id_seq'),
+ artist_id INTEGER REFERENCES artists (id) NULL,
+ name VARCHAR,
+ tracks INTEGER,
+ UNIQUE(artist_id, name));
+ALTER SEQUENCE albums_id_seq OWNED BY albums.id;
+
+CREATE SEQUENCE tracks_id_seq;
+CREATE TABLE tracks (
+ id INTEGER PRIMARY KEY DEFAULT nextval('tracks_id_seq'),
+ artist_id INTEGER REFERENCES artists (id) NULL,
+ album_id INTEGER REFERENCES albums (id) NULL,
+ name VARCHAR,
+ length INTEGER,
+ num INTEGER,
+ file_name VARCHAR,
+ file_index INTEGER,
+ UNIQUE(artist_id, name));
+ALTER SEQUENCE tracks_id_seq OWNED BY tracks.id;
+
+COMMIT;