Generate postgres.gen.go using schema version directory structure (#808)
* Reorganize the db migration .sql scripts into individual schema version directories and generate the sql httpfs fakeFile accordingly. * Created a /dev schema version directory to hold db schema updates that have not been finalized. * Add an 'allow-development-migrations' flag to allow `boundary database init` to be executed even when there are schema updates in /dev.
This commit is contained in:
1 parent
d8f8d60418
commit
f6e50006fc
53 files changed
+116
-29
No files matched your search
@@ -0,0 +1,50 @@
|
||||
begin;
|
||||
|
||||
-- For now at least the IDs will be the same as the name, because this allows us
|
||||
-- to not have to persist some generated ID to worker and controller nodes.
|
||||
-- Eventually we may want them to diverge, so we have both here for now.
|
||||
|
||||
create table server (
|
||||
private_id text,
|
||||
type text,
|
||||
name text not null unique
|
||||
constraint server_name_must_not_be_empty
|
||||
check(length(trim(name)) > 0),
|
||||
description text,
|
||||
address text,
|
||||
create_time wt_timestamp,
|
||||
update_time wt_timestamp,
|
||||
primary key (private_id, type)
|
||||
);
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on server
|
||||
for each row execute procedure immutable_columns('create_time');
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on server
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create table recovery_nonces (
|
||||
nonce text
|
||||
primary key,
|
||||
create_time wt_timestamp
|
||||
);
|
||||
|
||||
create trigger
|
||||
default_create_time_column
|
||||
before
|
||||
insert on recovery_nonces
|
||||
for each row execute procedure default_create_time();
|
||||
|
||||
create trigger
|
||||
immutable_columns
|
||||
before
|
||||
update on recovery_nonces
|
||||
for each row execute procedure immutable_columns('nonce', 'create_time');
|
||||
|
||||
commit;
|
||||
Reference in new issue
Block a user