summaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'migrations')
-rw-r--r--migrations/4_add_user_default_target.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/migrations/4_add_user_default_target.sql b/migrations/4_add_user_default_target.sql
new file mode 100644
index 0000000..89d0b25
--- /dev/null
+++ b/migrations/4_add_user_default_target.sql
@@ -0,0 +1,12 @@
+CREATE TABLE user_default_target(
+ "user" INTEGER NOT NULL,
+ target INTEGER NOT NULL,
+ PRIMARY KEY("user", target),
+ FOREIGN KEY("user") REFERENCES users,
+ FOREIGN KEY(target) REFERENCES roles
+);
+
+INSERT INTO user_default_target
+ SELECT users.id, roles.id
+ FROM users
+ INNER JOIN roles ON (roles."name" = 'Inner Circle');