forked from 3wordchant/capsul-flask
start working on managed IPs
This commit is contained in:
6
capsulflask/schema_migrations/16_down_managed_ips.sql
Normal file
6
capsulflask/schema_migrations/16_down_managed_ips.sql
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
DROP TABLE host_network;
|
||||
|
||||
ALTER TABLE vms DROP COLUMN network;
|
||||
|
||||
UPDATE schemaversion SET version = 15;
|
14
capsulflask/schema_migrations/16_up_managed_ips.sql
Normal file
14
capsulflask/schema_migrations/16_up_managed_ips.sql
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
CREATE TABLE host_network (
|
||||
public_ipv4_cidr_block TEXT PRIMARY KEY NOT NULL,
|
||||
network_name TEXT NOT NULL,
|
||||
host TEXT NOT NULL REFERENCES hosts(id) ON DELETE RESTRICT,
|
||||
);
|
||||
|
||||
INSERT INTO host_network (public_ipv4_cidr_block, network_name, host) VALUES ('baikal', 'virbr1', '69.61.2.162/27'),
|
||||
('baikal', 'virbr2', '69.61.2.194/26');
|
||||
|
||||
ALTER TABLE vms ADD COLUMN network_name TEXT NOT NULL;
|
||||
ALTER TABLE vms ADD FOREIGN KEY (host, network_name) REFERENCES host_network(host, network_name) ON DELETE RESTRICT;
|
||||
|
||||
UPDATE schemaversion SET version = 16;
|
Reference in New Issue
Block a user