mirror of
https://github.com/openziti/zrok.git
synced 2025-01-18 11:58:17 +01:00
ddl for organizations and memberships (#537)
This commit is contained in:
parent
f86546b2aa
commit
d6c8f206b2
@ -0,0 +1,27 @@
|
|||||||
|
-- +migrate Up
|
||||||
|
|
||||||
|
create table organizations (
|
||||||
|
id serial primary key,
|
||||||
|
|
||||||
|
token varchar(32) not null,
|
||||||
|
description varchar(128),
|
||||||
|
|
||||||
|
created_at timestamptz not null default(current_timestamp),
|
||||||
|
updated_at timestamptz not null default(current_timestamp),
|
||||||
|
deleted boolean not null default(false)
|
||||||
|
);
|
||||||
|
|
||||||
|
create index organizations_token_idx on organizations(token);
|
||||||
|
|
||||||
|
create table organization_members (
|
||||||
|
id serial primary key,
|
||||||
|
|
||||||
|
organization_id integer references organizations(id) not null,
|
||||||
|
account_id integer references accounts(id) not null,
|
||||||
|
admin boolean not null default(false),
|
||||||
|
|
||||||
|
created_at timestamptz not null default(current_timestamp),
|
||||||
|
updated_at timestamptz not null default(current_timestamp)
|
||||||
|
);
|
||||||
|
|
||||||
|
create index organization_members_account_id_idx on organization_members(account_id);
|
27
controller/store/sql/sqlite3/030_v0_4_45_organizations.sql
Normal file
27
controller/store/sql/sqlite3/030_v0_4_45_organizations.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
-- +migrate Up
|
||||||
|
|
||||||
|
create table organizations (
|
||||||
|
id serial primary key,
|
||||||
|
|
||||||
|
token varchar(32) not null,
|
||||||
|
description varchar(128),
|
||||||
|
|
||||||
|
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||||
|
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||||
|
deleted boolean not null default(false)
|
||||||
|
);
|
||||||
|
|
||||||
|
create index organization_token_idx on organizations(token);
|
||||||
|
|
||||||
|
create table organization_members (
|
||||||
|
id serial primary key,
|
||||||
|
|
||||||
|
organization_id integer references organizations(id) not null,
|
||||||
|
account_id integer references accounts(id) not null,
|
||||||
|
admin boolean not null default(false),
|
||||||
|
|
||||||
|
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||||
|
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now'))
|
||||||
|
);
|
||||||
|
|
||||||
|
create index organization_members_account_id_idx on organization_members(account_id);
|
Loading…
Reference in New Issue
Block a user