summaryrefslogtreecommitdiff
path: root/migrations/4_add_user_default_target.sql
blob: 89d0b25b2bd49e654977fb15af70abe2128bbb22 (plain)
1
2
3
4
5
6
7
8
9
10
11
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');