CREATE SEQUENCE "buildings_id_seq"; CREATE TABLE "buildings" ( "id" integer NOT NULL DEFAULT nextval('csvdevel.buildings_id_seq'), "role" varchar(32) NOT NULL, "colonycenter" boolean NOT NULL DEFAULT false, "name" varchar(256) NOT NULL UNIQUE, "description" text NOT NULL, "upkeep" int8 NOT NULL, "moraleffect" real NOT NULL DEFAULT 0, "defpriority" integer NOT NULL UNIQUE, "structure" integer NOT NULL, "startwith" integer NOT NULL DEFAULT 0, "workers" integer NOT NULL, "powerneed" integer NOT NULL, "space" integer NOT NULL, PRIMARY KEY ("id"), CONSTRAINT "buildings_structure_chk" CHECK ("structure">=0) ); CREATE TABLE "buildings_house" ( "role" varchar(32) NOT NULL DEFAULT 'house', "accomondate" integer NOT NULL, CHECK ("role" = 'house') ) INHERITS ("buildings"); CREATE TABLE "buildings_barrack" ( "role" varchar(32) NOT NULL DEFAULT 'barrack', "military_accom" integer NOT NULL, CHECK ("role" = 'barrack') ) INHERITS ("buildings"); CREATE TABLE "buildings_powerplant" ( "role" varchar(32) NOT NULL DEFAULT 'powerplant', "poweroutput" integer NOT NULL, CHECK ("role" = 'powerplant') ) INHERITS ("buildings"); CREATE TABLE "buildings_buildingplant" ( "role" varchar(32) NOT NULL DEFAULT 'buildingplant', "buildoutput" integer NOT NULL, CHECK ("role" = 'buildingplant') ) INHERITS ("buildings"); CREATE TABLE "buildings_researchcenter" ( "role" varchar(32) NOT NULL DEFAULT 'researchcenter', "researchoutput" integer NOT NULL, CHECK ("role" = 'researchcenter') ) INHERITS ("buildings"); CREATE TABLE "buildings_warehouse" ( "role" varchar(32) NOT NULL DEFAULT 'warehouse', "storage" integer NOT NULL, CHECK ("role" = 'warehouse') ) INHERITS ("buildings"); CREATE TABLE "buildings_colonycenter" ( "role" varchar(32) NOT NULL DEFAULT 'colonycenter', "colonycenter" boolean NOT NULL DEFAULT true, CHECK ("role" = 'colonycenter') ) INHERITS ("buildings_house","buildings_buildingplant","buildings_warehouse","buildings_powerplant");