summaryrefslogtreecommitdiff
path: root/migrations/4_add_user_default_target.sql
blob: 44864108528ea33900cf6163af848cee8942fd5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BEGIN TRANSACTION;

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');

COMMIT;