sqlite3 port of the DDL changes (#20, #88)

This commit is contained in:
Michael Quigley 2022-11-17 09:13:37 -05:00
parent 24f2e48e48
commit dcdc00dcf4
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -0,0 +1,27 @@
-- +migrate Up
create table frontends (
id serial primary key,
environment_id integer references environments(id),
z_id varchar(32) not null unique,
name varchar(64) 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'))
);
-- environments.account_id should allow NULL; environments with NULL account_id are "ephemeral"
alter table environments rename to environments_old;
create table environments (
id integer primary key,
account_id integer references accounts(id) on delete cascade,
description string,
host string,
address string,
z_id 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')),
constraint chk_z_id check (z_id <> '')
);
insert into environments select * from environments_old;
drop table environments_old;