269 CONSTRAINT travaille_relation_p_key PRIMARY KEY(eid_from, eid_to) |
269 CONSTRAINT travaille_relation_p_key PRIMARY KEY(eid_from, eid_to) |
270 ); |
270 ); |
271 |
271 |
272 CREATE INDEX travaille_relation_from_idx ON travaille_relation(eid_from); |
272 CREATE INDEX travaille_relation_from_idx ON travaille_relation(eid_from); |
273 CREATE INDEX travaille_relation_to_idx ON travaille_relation(eid_to); |
273 CREATE INDEX travaille_relation_to_idx ON travaille_relation(eid_to); |
274 |
|
275 CREATE TABLE works_for_relation ( |
|
276 eid_from INTEGER NOT NULL REFERENCES entities (eid), |
|
277 eid_to INTEGER NOT NULL REFERENCES entities (eid), |
|
278 CONSTRAINT works_for_relation_p_key PRIMARY KEY(eid_from, eid_to) |
|
279 ); |
|
280 |
|
281 CREATE INDEX works_for_relation_from_idx ON works_for_relation(eid_from); |
|
282 CREATE INDEX works_for_relation_to_idx ON works_for_relation(eid_to); |
|
283 """ |
274 """ |
284 |
275 |
285 class SQLSchemaTC(TestCase): |
276 class SQLSchemaTC(TestCase): |
286 |
277 |
287 def test_known_values(self): |
278 def test_known_values(self): |
288 dbhelper = get_db_helper('postgres') |
279 dbhelper = get_db_helper('postgres') |
289 output = schema2sql.schema2sql(dbhelper, schema) |
280 output = schema2sql.schema2sql(dbhelper, schema, skip_relations=('works_for',)) |
290 self.assertMultiLineEqual(EXPECTED_DATA_NO_DROP.strip(), output.strip()) |
281 self.assertMultiLineEqual(EXPECTED_DATA_NO_DROP.strip(), output.strip()) |
291 |
282 |
292 |
283 |
293 if __name__ == '__main__': |
284 if __name__ == '__main__': |
294 unittest_main() |
285 unittest_main() |