2023-10-07 04:49:28 -05:00
|
|
|
/* init_order = 1 */
|
|
|
|
|
|
|
|
/** Organizations defined by [RFC 0001](https://github.com/logto-io/rfcs/blob/HEAD/active/0001-organization.md). */
|
|
|
|
create table organizations (
|
|
|
|
tenant_id varchar(21) not null
|
|
|
|
references tenants (id) on update cascade on delete cascade,
|
|
|
|
/** The globally unique identifier of the organization. */
|
|
|
|
id varchar(21) not null,
|
|
|
|
/** The organization's name for display. */
|
|
|
|
name varchar(128) not null,
|
|
|
|
/** A brief description of the organization. */
|
2023-10-08 00:47:22 -05:00
|
|
|
description varchar(256),
|
2024-04-25 09:16:59 -05:00
|
|
|
/** Additional data associated with the organization. */
|
|
|
|
custom_data jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
2023-10-07 04:49:28 -05:00
|
|
|
/** When the organization was created. */
|
|
|
|
created_at timestamptz not null default(now()),
|
|
|
|
primary key (id)
|
|
|
|
);
|
|
|
|
|
|
|
|
create index organizations__id
|
|
|
|
on organizations (tenant_id, id);
|