schema fixes

This commit is contained in:
Mike McLean 2018-04-27 15:36:36 -04:00
parent 50a8254df8
commit 5ec9e2379c
2 changed files with 4 additions and 4 deletions

View file

@ -25,7 +25,7 @@ CREATE TABLE host_config (
PRIMARY KEY (create_event, host_id),
UNIQUE (host_id, active)
) WITHOUT OIDS;
CREATE INDEX host_config_by_active_and_enabled ON host_config(active, enabled)
CREATE INDEX host_config_by_active_and_enabled ON host_config(active, enabled);
-- copy starting data
-- CREATE FUNCTION pg_temp.user() returns INTEGER as $$ select id from users where name='nobody' $$ language SQL;
@ -46,7 +46,7 @@ ALTER TABLE host DROP COLUMN comment;
ALTER TABLE host DROP COLUMN enabled;
-- history for host_channels
SELECT 'Adding versions to host_channels'
SELECT 'Adding versions to host_channels';
ALTER TABLE host_channels ADD COLUMN create_event INTEGER NOT NULL REFERENCES events(id) DEFAULT get_event();
ALTER TABLE host_channels ADD COLUMN revoke_event INTEGER REFERENCES events(id);
-- we need some default for alter table, but drop it after

View file

@ -146,7 +146,7 @@ CREATE TABLE host (
user_id INTEGER NOT NULL REFERENCES users (id),
name VARCHAR(128) UNIQUE NOT NULL,
task_load FLOAT CHECK (NOT task_load < 0) NOT NULL DEFAULT 0.0,
ready BOOLEAN NOT NULL DEFAULT 'false',
ready BOOLEAN NOT NULL DEFAULT 'false'
) WITHOUT OIDS;
CREATE TABLE host_config (
@ -168,7 +168,7 @@ CREATE TABLE host_config (
PRIMARY KEY (create_event, host_id),
UNIQUE (host_id, active)
) WITHOUT OIDS;
CREATE INDEX host_config_by_active_and_enabled ON host_config(active, enabled)
CREATE INDEX host_config_by_active_and_enabled ON host_config(active, enabled);
CREATE TABLE host_channels (
host_id INTEGER NOT NULL REFERENCES host(id),