Skip to content

Instantly share code, notes, and snippets.

@fire
Created July 5, 2015 17:44
Show Gist options
  • Save fire/8a56d67980effb6bc0bb to your computer and use it in GitHub Desktop.
Save fire/8a56d67980effb6bc0bb to your computer and use it in GitHub Desktop.
create TABLE "assemblage" (
"assemblage_id" bigserial not null default nextval('nx.assemblages_assemblage_id_seq'::regclass),
" component_id" bigserial not null default nextval('nx."assemblages_ component_id_seq"'::regclass),
PRIMARY KEY ("assemblage_id")
);
create TABLE "assemblage_component" (
"assemblage_id" int8 not null,
"component_id" int8 not null,
FOREIGN KEY ("assemblage_id") REFERENCES "assemblage" ("assemblage_id"),
FOREIGN KEY ("component_id") REFERENCES "component" ("component_id")
);
CREATE UNIQUE INDEX "unique_component_id" ON "assemblage_component" ("component_id");
create TABLE "component" (
"component_id" int8 not null,
"offical_name" text(2147483647) not null,
"human_readable_description" text(2147483647) not null,
"table_name" text(2147483647) not null,
PRIMARY KEY ("component_id")
);
create TABLE "component_data_table_000001" (
"component_data_id" int8 not null,
FOREIGN KEY ("component_data_id") REFERENCES "entity_components" ("component_data_id")
);
create TABLE "entity" (
"entity_id" bigserial not null default nextval('nx.entity_entity_id_seq'::regclass),
"human-readable label" text(2147483647) not null,
PRIMARY KEY ("entity_id")
);
create TABLE "entity_components" (
"entity_id" int8 not null,
"component_id" int8 not null,
"component_data_id" int8 not null,
FOREIGN KEY ("component_id") REFERENCES "component" ("component_id"),
FOREIGN KEY ("entity_id") REFERENCES "entity" ("entity_id")
);
CREATE UNIQUE INDEX "unique_component_data_id" ON "entity_components" ("component_data_id");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment