1 | -- ---------------------------- |
---|
2 | -- Table structure for "simulation" |
---|
3 | -- ---------------------------- |
---|
4 | DROP TABLE "simulation"; |
---|
5 | CREATE TABLE "public"."simulation" ( |
---|
6 | "id" int4 DEFAULT NULL NOT NULL, |
---|
7 | "location" varchar(1000) DEFAULT NULL, |
---|
8 | "xmlnsheader" varchar(1000) DEFAULT NULL, |
---|
9 | CONSTRAINT "simulation_pkey" PRIMARY KEY ("id") |
---|
10 | ) |
---|
11 | WITH (OIDS=FALSE); |
---|
12 | |
---|
13 | ALTER TABLE "public"."simulation" OWNER TO "postgres";; |
---|
14 | |
---|
15 | -- ---------------------------- |
---|
16 | -- Table structure for "simulation_attribute" |
---|
17 | -- ---------------------------- |
---|
18 | DROP TABLE "simulation_attribute"; |
---|
19 | CREATE TABLE "public"."simulation_attribute" ( |
---|
20 | "id" int4 DEFAULT NULL NOT NULL, |
---|
21 | "name" varchar(100) DEFAULT NULL::character varying, |
---|
22 | "value" varchar(1000) DEFAULT NULL::character varying, |
---|
23 | CONSTRAINT "simulation_attribute_copy_pkey" PRIMARY KEY ("id") |
---|
24 | ) |
---|
25 | WITH (OIDS=FALSE); |
---|
26 | |
---|
27 | ALTER TABLE "public"."simulation_attribute" OWNER TO "postgres";; |
---|
28 | |
---|
29 | -- ---------------------------- |
---|
30 | -- Table structure for "simulation_dimension" |
---|
31 | -- ---------------------------- |
---|
32 | DROP TABLE "simulation_dimension"; |
---|
33 | CREATE TABLE "public"."simulation_dimension" ( |
---|
34 | "id" int4 DEFAULT NULL NOT NULL, |
---|
35 | "name" varchar(100) DEFAULT NULL::character varying NOT NULL, |
---|
36 | "length" varchar(40) DEFAULT NULL::character varying NOT NULL, |
---|
37 | "isunlimited" bool DEFAULT NULL, |
---|
38 | CONSTRAINT "simulation_dimension_copy_pkey" PRIMARY KEY ("id") |
---|
39 | ) |
---|
40 | WITH (OIDS=FALSE); |
---|
41 | |
---|
42 | ALTER TABLE "public"."simulation_dimension" OWNER TO "postgres";; |
---|
43 | |
---|
44 | -- ---------------------------- |
---|
45 | -- Table structure for "simulation_variable" |
---|
46 | -- ---------------------------- |
---|
47 | DROP TABLE "simulation_variable"; |
---|
48 | CREATE TABLE "public"."simulation_variable" ( |
---|
49 | "id" int4 DEFAULT NULL NOT NULL, |
---|
50 | "name" varchar(40) DEFAULT NULL::character varying NOT NULL, |
---|
51 | "shape" varchar(100) DEFAULT NULL::character varying, |
---|
52 | "type" varchar(40) DEFAULT NULL::character varying, |
---|
53 | "units" varchar(40) DEFAULT NULL::character varying, |
---|
54 | "long_name" varchar(100) DEFAULT NULL::character varying, |
---|
55 | CONSTRAINT "simulation_variable_copy_pkey" PRIMARY KEY ("id") |
---|
56 | ) |
---|
57 | WITH (OIDS=FALSE); |
---|
58 | |
---|
59 | ALTER TABLE "public"."simulation_variable" OWNER TO "postgres";; |
---|
60 | |
---|
61 | -- ---------------------------- |
---|
62 | -- Table structure for "rel_simulation_attribute" |
---|
63 | -- ---------------------------- |
---|
64 | DROP TABLE "rel_simulation_attribute"; |
---|
65 | CREATE TABLE "public"."rel_simulation_attribute" ( |
---|
66 | "simulation_id" int4 DEFAULT NULL NOT NULL, |
---|
67 | "attribute_id" int4 DEFAULT NULL NOT NULL, |
---|
68 | CONSTRAINT "rel_simulation_attribute_pkey" PRIMARY KEY ("simulation_id", "attribute_id"), |
---|
69 | CONSTRAINT "rel_simulation_attribute_simulation_id_fkey" FOREIGN KEY ("simulation_id") REFERENCES "public"."simulation" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, |
---|
70 | CONSTRAINT "rel_simulation_attribute_attribute_id_fkey" FOREIGN KEY ("attribute_id") REFERENCES "public"."simulation_attribute" ("id") ON DELETE CASCADE ON UPDATE NO ACTION |
---|
71 | ) |
---|
72 | WITH (OIDS=FALSE); |
---|
73 | |
---|
74 | ALTER TABLE "public"."rel_simulation_attribute" OWNER TO "postgres"; |
---|
75 | |
---|
76 | CREATE INDEX "ind_rel_simulation_attribute_attributekey" ON "public"."rel_simulation_attribute" USING btree ("attribute_id"); |
---|
77 | CREATE INDEX "ind_rel_simulation_attribute_simulationkey" ON "public"."rel_simulation_attribute" USING btree ("simulation_id");; |
---|
78 | |
---|
79 | |
---|
80 | -- ---------------------------- |
---|
81 | -- Table structure for "rel_simulation_dimension" |
---|
82 | -- ---------------------------- |
---|
83 | DROP TABLE "rel_simulation_dimension"; |
---|
84 | CREATE TABLE "public"."rel_simulation_dimension" ( |
---|
85 | "simulation_id" int4 DEFAULT NULL, |
---|
86 | "dimension_id" int4 DEFAULT NULL, |
---|
87 | CONSTRAINT "rel_simulation_dimension_simulation_id_fkey" FOREIGN KEY ("simulation_id") REFERENCES "public"."simulation" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, |
---|
88 | CONSTRAINT "rel_simulation_dimension_dimension_id_fkey" FOREIGN KEY ("dimension_id") REFERENCES "public"."simulation_dimension" ("id") ON DELETE CASCADE ON UPDATE NO ACTION |
---|
89 | ) |
---|
90 | WITH (OIDS=FALSE); |
---|
91 | |
---|
92 | ALTER TABLE "public"."rel_simulation_dimension" OWNER TO "postgres"; |
---|
93 | |
---|
94 | CREATE INDEX "ind_rel_simulation_dimension_dimensionkey" ON "public"."rel_simulation_dimension" USING btree ("dimension_id"); |
---|
95 | CREATE INDEX "ind_rel_simulation_dimension_simulationkey" ON "public"."rel_simulation_dimension" USING btree ("simulation_id");; |
---|
96 | |
---|
97 | |
---|
98 | -- ---------------------------- |
---|
99 | -- Table structure for "rel_simulation_variable" |
---|
100 | -- ---------------------------- |
---|
101 | DROP TABLE "rel_simulation_variable"; |
---|
102 | CREATE TABLE "public"."rel_simulation_variable" ( |
---|
103 | "simulation_id" int4 DEFAULT NULL NOT NULL, |
---|
104 | "variable_id" int4 DEFAULT NULL NOT NULL, |
---|
105 | CONSTRAINT "rel_simulation_variable_pkey" PRIMARY KEY ("simulation_id", "variable_id"), |
---|
106 | CONSTRAINT "rel_simulation_variable_simulation_id_fkey" FOREIGN KEY ("simulation_id") REFERENCES "public"."simulation" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, |
---|
107 | CONSTRAINT "rel_simulation_variable_variable_id_fkey" FOREIGN KEY ("variable_id") REFERENCES "public"."simulation_variable" ("id") ON DELETE CASCADE ON UPDATE NO ACTION |
---|
108 | ) |
---|
109 | WITH (OIDS=FALSE); |
---|
110 | |
---|
111 | ALTER TABLE "public"."rel_simulation_variable" OWNER TO "postgres"; |
---|
112 | |
---|
113 | CREATE INDEX "ind_rel_simulation_variable_simulationkey" ON "public"."rel_simulation_variable" USING btree ("simulation_id"); |
---|
114 | CREATE INDEX "ind_rel_simulation_variable_variablekey" ON "public"."rel_simulation_variable" USING btree ("variable_id");; |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | /* ****************************************************************** */ |
---|
119 | /* **************** TABLES DE RELATION DE SIMULATION **************** */ |
---|
120 | /* ****************************************************************** */ |
---|
121 | /* Création des tables via navicat, puis index et clefs étrangÚres en mode commande, car gros bug via navicat */ |
---|
122 | |
---|
123 | /* REL_SIMULATION_DIMENSION */ |
---|
124 | CREATE INDEX "ind_rel_simulation_dimension_simulationkey" ON "public"."rel_simulation_dimension" ("simulation_id" ); |
---|
125 | CREATE INDEX "ind_rel_simulation_dimension_dimensionkey" ON "public"."rel_simulation_dimension" ("dimension_id" ); |
---|
126 | ALTER TABLE rel_simulation_dimension ADD FOREIGN KEY(simulation_id) REFERENCES simulation ON DELETE CASCADE; |
---|
127 | ALTER TABLE rel_simulation_dimension ADD FOREIGN KEY(dimension_id) REFERENCES simulation_dimension ON DELETE CASCADE; |
---|
128 | |
---|
129 | /* REL_SIMULATION_ATTRIBUTE */ |
---|
130 | CREATE INDEX "ind_rel_simulation_attribute_simulationkey" ON "public"."rel_simulation_attribute" ("simulation_id" ); |
---|
131 | CREATE INDEX "ind_rel_simulation_attribute_attributekey" ON "public"."rel_simulation_attribute" ("attribute_id" ); |
---|
132 | ALTER TABLE rel_simulation_attribute ADD FOREIGN KEY(simulation_id) REFERENCES simulation ON DELETE CASCADE; |
---|
133 | ALTER TABLE rel_simulation_attribute ADD FOREIGN KEY(attribute_id) REFERENCES simulation_attribute ON DELETE CASCADE; |
---|
134 | |
---|
135 | /* REL_SIMULATION_VARIABLE */ |
---|
136 | CREATE INDEX "ind_rel_simulation_variable_simulationkey" ON "public"."rel_simulation_variable" ("simulation_id" ); |
---|
137 | CREATE INDEX "ind_rel_simulation_variable_variablekey" ON "public"."rel_simulation_variable" ("variable_id" ); |
---|
138 | ALTER TABLE rel_simulation_variable ADD FOREIGN KEY(simulation_id) REFERENCES simulation ON DELETE CASCADE; |
---|
139 | ALTER TABLE rel_simulation_variable ADD FOREIGN KEY(variable_id) REFERENCES simulation_variable ON DELETE CASCADE; |
---|