aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-10-27 18:45:06 -0700
committerJakob Odersky <jakob@odersky.com>2018-10-27 18:45:06 -0700
commitde095d377859887352c7380e52ea89bcabf662a0 (patch)
tree6cee6eb17c1977b85e01078e926499b33854047d /migrations
downloadbyspel-de095d377859887352c7380e52ea89bcabf662a0.tar.gz
byspel-de095d377859887352c7380e52ea89bcabf662a0.tar.bz2
byspel-de095d377859887352c7380e52ea89bcabf662a0.zip
Initial commit
Diffstat (limited to 'migrations')
-rw-r--r--migrations/deploy/sessions.sql13
-rw-r--r--migrations/deploy/users.sql19
-rw-r--r--migrations/revert/sessions.sql7
-rw-r--r--migrations/revert/users.sql8
-rw-r--r--migrations/sqitch.plan5
-rw-r--r--migrations/verify/sessions.sql7
-rw-r--r--migrations/verify/users.sql7
7 files changed, 66 insertions, 0 deletions
diff --git a/migrations/deploy/sessions.sql b/migrations/deploy/sessions.sql
new file mode 100644
index 0000000..6d0122c
--- /dev/null
+++ b/migrations/deploy/sessions.sql
@@ -0,0 +1,13 @@
+-- Deploy byspel:sessions to sqlite
+-- requires: users
+
+BEGIN;
+
+create table sessions(
+ session_id uuid not null primary key,
+ user_id uuid not null,
+ expires timestamp not null,
+ foreign key (user_id) references users(id) on delete cascade
+);
+
+COMMIT;
diff --git a/migrations/deploy/users.sql b/migrations/deploy/users.sql
new file mode 100644
index 0000000..63b25cc
--- /dev/null
+++ b/migrations/deploy/users.sql
@@ -0,0 +1,19 @@
+-- Deploy byspel:users to sqlite
+
+BEGIN;
+
+create table users(
+ id uuid not null primary key,
+ primary_email string not null unique,
+ full_name string,
+ avatar string not null,
+ last_login timestamp
+);
+
+create table shadow(
+ user_id uuid not null primary key,
+ hash string not null,
+ foreign key (user_id) references users(id)
+);
+
+COMMIT;
diff --git a/migrations/revert/sessions.sql b/migrations/revert/sessions.sql
new file mode 100644
index 0000000..8763989
--- /dev/null
+++ b/migrations/revert/sessions.sql
@@ -0,0 +1,7 @@
+-- Revert byspel:sessions from sqlite
+
+BEGIN;
+
+drop table sessions;
+
+COMMIT;
diff --git a/migrations/revert/users.sql b/migrations/revert/users.sql
new file mode 100644
index 0000000..e3c42d9
--- /dev/null
+++ b/migrations/revert/users.sql
@@ -0,0 +1,8 @@
+-- Revert byspel:users from sqlite
+
+BEGIN;
+
+drop table users;
+drop table shadow;
+
+COMMIT;
diff --git a/migrations/sqitch.plan b/migrations/sqitch.plan
new file mode 100644
index 0000000..7b153e8
--- /dev/null
+++ b/migrations/sqitch.plan
@@ -0,0 +1,5 @@
+%syntax-version=1.0.0
+%project=byspel
+
+users 2018-10-27T05:12:05Z Jakob Odersky <jakob@odersky.com> # Add users and shadow tables
+sessions [users] 2018-10-27T08:05:32Z Jakob Odersky <jakob@odersky.com> # Add sessions table
diff --git a/migrations/verify/sessions.sql b/migrations/verify/sessions.sql
new file mode 100644
index 0000000..c4fff42
--- /dev/null
+++ b/migrations/verify/sessions.sql
@@ -0,0 +1,7 @@
+-- Verify byspel:sessions on sqlite
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
diff --git a/migrations/verify/users.sql b/migrations/verify/users.sql
new file mode 100644
index 0000000..24a7b50
--- /dev/null
+++ b/migrations/verify/users.sql
@@ -0,0 +1,7 @@
+-- Verify byspel:users on sqlite
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;