0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-13 21:30:30 -05:00
logto/packages/schemas/tables/resources.sql

22 lines
667 B
MySQL
Raw Permalink Normal View History

2023-01-28 12:29:47 +08:00
/* init_order = 1 */
create table resources (
2023-01-19 20:27:01 +08:00
tenant_id varchar(21) not null
references tenants (id) on update cascade on delete cascade,
id varchar(21) not null,
name text not null,
2023-01-28 12:29:47 +08:00
indicator text not null, /* resource indicator also used as audience */
2023-05-29 18:44:56 +08:00
is_default boolean not null default (false),
2023-01-19 20:27:01 +08:00
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)
);
2023-01-19 20:27:01 +08:00
create index resources__id
2023-01-28 12:29:47 +08:00
on resources (tenant_id, id);
2023-05-29 18:44:56 +08:00
create unique index resources__is_default_true
on resources (tenant_id)
where is_default = true;