|
| 1 | +create table "Access" |
| 2 | +( |
| 3 | + "id" integer not null |
| 4 | + primary key, |
| 5 | + "debug" integer default 0 not null, |
| 6 | + "name" varchar(50) default '实际表名,例如 apijson_user' not null, |
| 7 | + "alias" varchar(50), |
| 8 | + "get" text default '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' not null, |
| 9 | + "head" text default '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' not null, |
| 10 | + "gets" text default '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' not null, |
| 11 | + "heads" text default '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' not null, |
| 12 | + "post" text default '["OWNER", "ADMIN"]' not null, |
| 13 | + "put" text default '["OWNER", "ADMIN"]' not null, |
| 14 | + "delete" text default '["OWNER", "ADMIN"]' not null, |
| 15 | + "date" text default CURRENT_TIMESTAMP not null |
| 16 | +); |
| 17 | + |
| 18 | +comment on table "Access" is '权限配置'; |
| 19 | + |
| 20 | + |
| 21 | +comment on column "Access"."id" is '唯一标识'; |
| 22 | + |
| 23 | +comment on column "Access"."debug" is '是否为调试表,只允许在开发环境使用,测试和线上环境禁用'; |
| 24 | + |
| 25 | +comment on column "Access"."alias" is '外部调用的表别名,例如 User'; |
| 26 | + |
| 27 | +comment on column "Access"."get" is '允许 get 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] |
| 28 | +用 JSON 类型不能设置默认值,反正权限对应的需求是明确的,也不需要自动转 JSONArray。 |
| 29 | +TODO: 直接 LOGIN,CONTACT,CIRCLE,OWNER 更简单,反正是开发内部用,不需要复杂查询。'; |
| 30 | + |
| 31 | +comment on column "Access"."head" is '允许 head 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 32 | + |
| 33 | +comment on column "Access"."gets" is '允许 gets 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 34 | + |
| 35 | +comment on column "Access"."heads" is '允许 heads 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 36 | + |
| 37 | +comment on column "Access"."post" is '允许 post 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 38 | + |
| 39 | +comment on column "Access"."put" is '允许 put 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 40 | + |
| 41 | +comment on column "Access"."delete" is '允许 delete 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]'; |
| 42 | + |
| 43 | +comment on column "Access"."date" is '创建时间'; |
| 44 | + |
| 45 | + |
| 46 | +create unique index access_alias_uindex |
| 47 | + on "Access" ("alias"); |
| 48 | + |
| 49 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (1, 1, 'Access', '', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2019-07-21 12:21:36'); |
| 50 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (2, 1, 'Table', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:14'); |
| 51 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (3, 1, 'Column', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:14'); |
| 52 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (4, 1, 'Function', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:15'); |
| 53 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (5, 1, 'Request', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:14'); |
| 54 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (6, 1, 'Response', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:15'); |
| 55 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (7, 1, 'Document', null, '["LOGIN", "ADMIN"]', '["LOGIN", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["LOGIN", "ADMIN"]', '["OWNER", "ADMIN"]', '2018-11-28 16:38:15'); |
| 56 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (8, 1, 'TestRecord', null, '["LOGIN", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '2018-11-28 16:38:15'); |
| 57 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (9, 0, 'Test', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:15'); |
| 58 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (10, 1, 'PgAttribute', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:14'); |
| 59 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (11, 1, 'PgClass', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[]', '[]', '[]', '2018-11-28 16:38:14'); |
| 60 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (12, 0, 'Login', null, '[]', '[]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[ "ADMIN"]', '[ "ADMIN"]', '["ADMIN"]', '2018-11-28 16:29:48'); |
| 61 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (13, 0, 'Verify', null, '[]', '[]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '[ "ADMIN"]', '["ADMIN"]', '2018-11-28 16:29:48'); |
| 62 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (14, 0, 'apijson_user', 'User', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN","LOGIN","OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["ADMIN"]', '2018-11-28 16:28:53'); |
| 63 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (15, 0, 'apijson_privacy', 'Privacy', '[]', '[]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["UNKNOWN","LOGIN","OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["ADMIN"]', '2018-11-28 16:29:48'); |
| 64 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (16, 0, 'Moment', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '2018-11-28 16:29:19'); |
| 65 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (17, 0, 'Comment', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '2018-11-28 16:29:19'); |
| 66 | +INSERT INTO "Access" ("id", "debug", "name", "alias", "get", "head", "gets", "heads", "post", "put", "delete", "date") VALUES (18, 0, 'ViewTable', null, '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '["OWNER", "ADMIN"]', '2022-07-14 18:06:10.144056+00'); |
0 commit comments