2022-07-22 19:53:39 +02:00
|
|
|
-- +migrate Up
|
|
|
|
|
|
|
|
--
|
2022-07-25 22:03:51 +02:00
|
|
|
-- accounts
|
2022-07-22 19:53:39 +02:00
|
|
|
--
|
2022-07-25 22:03:51 +02:00
|
|
|
create table accounts (
|
2022-08-03 19:43:54 +02:00
|
|
|
id integer primary key,
|
2022-09-09 16:20:05 +02:00
|
|
|
email string not null unique,
|
2022-08-03 19:43:54 +02:00
|
|
|
password string not null,
|
|
|
|
token string not null unique,
|
|
|
|
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')),
|
2022-07-22 19:53:39 +02:00
|
|
|
|
2022-09-09 16:20:05 +02:00
|
|
|
constraint chk_email check (email <> ''),
|
|
|
|
constraint chk_password check (password <> ''),
|
2022-07-22 19:53:39 +02:00
|
|
|
constraint chk_token check(token <> '')
|
|
|
|
);
|
2022-07-29 17:10:39 +02:00
|
|
|
|
2022-09-09 19:35:21 +02:00
|
|
|
--
|
|
|
|
-- account_requests
|
|
|
|
--
|
|
|
|
create table account_requests (
|
|
|
|
id integer primary key,
|
|
|
|
token string not null unique,
|
|
|
|
email string not null unique,
|
|
|
|
source_address string not null,
|
|
|
|
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'))
|
|
|
|
);
|
|
|
|
|
2022-07-29 19:33:55 +02:00
|
|
|
--
|
2022-08-03 19:43:54 +02:00
|
|
|
-- environments
|
2022-07-29 19:33:55 +02:00
|
|
|
--
|
2022-08-03 19:43:54 +02:00
|
|
|
create table environments (
|
2022-10-19 18:10:22 +02:00
|
|
|
id integer primary key,
|
|
|
|
account_id integer constraint fk_accounts_identities references accounts on delete cascade,
|
|
|
|
description string,
|
|
|
|
host string,
|
|
|
|
address string,
|
2022-10-19 18:24:43 +02:00
|
|
|
z_id string not null unique,
|
2022-10-19 18:10:22 +02:00
|
|
|
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')),
|
2022-07-29 19:33:55 +02:00
|
|
|
|
2022-10-19 18:24:43 +02:00
|
|
|
constraint chk_z_id check (z_id <> '')
|
2022-07-29 19:33:55 +02:00
|
|
|
);
|
|
|
|
|
2022-07-29 17:10:39 +02:00
|
|
|
--
|
|
|
|
-- services
|
|
|
|
--
|
|
|
|
create table services (
|
2022-08-03 19:43:54 +02:00
|
|
|
id integer primary key,
|
2022-08-03 20:58:11 +02:00
|
|
|
environment_id integer constraint fk_environments_services references environments on delete cascade,
|
2022-10-19 18:10:22 +02:00
|
|
|
z_id string not null unique,
|
|
|
|
name string not null unique,
|
2022-09-28 20:47:42 +02:00
|
|
|
frontend string,
|
|
|
|
backend string,
|
2022-08-03 19:43:54 +02:00
|
|
|
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')),
|
2022-07-29 19:27:00 +02:00
|
|
|
|
2022-10-19 18:10:22 +02:00
|
|
|
constraint chk_z_id check (z_id <> ''),
|
|
|
|
constraint chk_name check (name <> '')
|
2022-07-29 17:10:39 +02:00
|
|
|
);
|