mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
19 lines
625 B
SQL
19 lines
625 B
SQL
/* init_order = 1 */
|
|
|
|
create table resources (
|
|
tenant_id varchar(21) not null
|
|
references tenants (id) on update cascade on delete cascade,
|
|
id varchar(21) not null,
|
|
name text not null,
|
|
indicator text not null, /* resource indicator also used as audience */
|
|
access_token_ttl bigint not null default(3600), /* expiration value in seconds, default is 1h */
|
|
primary key (id),
|
|
constraint resources__indicator
|
|
unique (tenant_id, indicator)
|
|
);
|
|
|
|
create index resources__id
|
|
on resources (tenant_id, id);
|
|
|
|
create trigger set_tenant_id before insert on resources
|
|
for each row execute procedure set_tenant_id();
|