mirror of
https://github.com/openziti/zrok.git
synced 2024-11-23 00:23:48 +01:00
basic schema conversion for postgres (#46)
This commit is contained in:
parent
bc75b312bf
commit
d479ff8609
62
controller/store/sql/postgresql/000_base.sql
Normal file
62
controller/store/sql/postgresql/000_base.sql
Normal file
@ -0,0 +1,62 @@
|
||||
-- +migrate Up
|
||||
|
||||
--
|
||||
-- accounts
|
||||
--
|
||||
create table accounts (
|
||||
id integer primary key,
|
||||
email varchar(1024) not null unique,
|
||||
password char(128) not null,
|
||||
token varchar(32) not null unique,
|
||||
created_at timestamp not null default(current_timestamp),
|
||||
updated_at timestamp not null default(current_timestamp),
|
||||
|
||||
constraint chk_email check (email <> ''),
|
||||
constraint chk_password check (password <> ''),
|
||||
constraint chk_token check(token <> '')
|
||||
);
|
||||
|
||||
--
|
||||
-- account_requests
|
||||
--
|
||||
create table account_requests (
|
||||
id integer primary key,
|
||||
token varchar(32) not null unique,
|
||||
email varchar(1024) not null unique,
|
||||
source_address varchar(64) not null,
|
||||
created_at timestamp not null default(current_timestamp),
|
||||
updated_at timestamp not null default(current_timestamp)
|
||||
);
|
||||
|
||||
--
|
||||
-- environments
|
||||
--
|
||||
create table environments (
|
||||
id integer primary key,
|
||||
account_id integer constraint fk_accounts_identities references accounts on delete cascade,
|
||||
description text,
|
||||
host varchar(256),
|
||||
address varchar(64),
|
||||
z_id varchar(32) not null unique,
|
||||
created_at timestamp not null default(current_timestamp),
|
||||
updated_at timestamp not null default(current_timestamp),
|
||||
|
||||
constraint chk_z_id check (z_id <> '')
|
||||
);
|
||||
|
||||
--
|
||||
-- services
|
||||
--
|
||||
create table services (
|
||||
id integer primary key,
|
||||
environment_id integer constraint fk_environments_services references environments on delete cascade,
|
||||
z_id varchar(32) not null unique,
|
||||
name varchar(32) not null unique,
|
||||
frontend varchar(1024),
|
||||
backend varchar(1024),
|
||||
created_at timestamp not null default(current_timestamp),
|
||||
updated_at timestamp not null default(current_timestamp),
|
||||
|
||||
constraint chk_z_id check (z_id <> ''),
|
||||
constraint chk_name check (name <> '')
|
||||
);
|
6
controller/store/sql/postgresql/embed.go
Normal file
6
controller/store/sql/postgresql/embed.go
Normal file
@ -0,0 +1,6 @@
|
||||
package postgresql_schema
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed *.sql
|
||||
var FS embed.FS
|
Loading…
Reference in New Issue
Block a user