author | Julien Cristau <julien.cristau@logilab.fr> |
Mon, 18 May 2015 20:00:06 +0200 | |
changeset 10436 | 6493c8bf521d |
parent 10204 | f8ccae1e271d |
child 10443 | 2d3834df64ab |
permissions | -rw-r--r-- |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
1 |
# copyright 2004-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
3 |
# |
10200
cceb2c7c02f4
Use our version of schema2sql
Julien Cristau <julien.cristau@logilab.fr>
parents:
10199
diff
changeset
|
4 |
# This file is part of CubicWeb. |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
5 |
# |
10200
cceb2c7c02f4
Use our version of schema2sql
Julien Cristau <julien.cristau@logilab.fr>
parents:
10199
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
9 |
# any later version. |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
10 |
# |
10200
cceb2c7c02f4
Use our version of schema2sql
Julien Cristau <julien.cristau@logilab.fr>
parents:
10199
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT ANY |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
12 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
13 |
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
14 |
# details. |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
15 |
# |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
10200
cceb2c7c02f4
Use our version of schema2sql
Julien Cristau <julien.cristau@logilab.fr>
parents:
10199
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
cceb2c7c02f4
Use our version of schema2sql
Julien Cristau <julien.cristau@logilab.fr>
parents:
10199
diff
changeset
|
18 |
"""unit tests for module cubicweb.server.schema2sql |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
19 |
""" |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
20 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
21 |
import os.path as osp |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
22 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
23 |
from logilab.common.testlib import TestCase, unittest_main |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
24 |
from logilab.database import get_db_helper |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
25 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
26 |
from yams.reader import SchemaLoader |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
27 |
from cubicweb.server import schema2sql |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
28 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
29 |
schema2sql.SET_DEFAULT = True |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
30 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
31 |
DATADIR = osp.abspath(osp.join(osp.dirname(__file__), 'data-schema2sql')) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
32 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
33 |
schema = SchemaLoader().load([DATADIR]) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
34 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
35 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
36 |
EXPECTED_DATA_NO_DROP = """ |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
37 |
CREATE TABLE Affaire( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
38 |
sujet varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
39 |
ref varchar(12), |
10201
989bbadbcd8d
Add foreign key for inline relations
Julien Cristau <julien.cristau@logilab.fr>
parents:
10200
diff
changeset
|
40 |
inline_rel integer REFERENCES entities (eid) |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
41 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
42 |
CREATE INDEX affaire_inline_rel_idx ON Affaire(inline_rel); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
43 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
44 |
CREATE TABLE Company( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
45 |
name text |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
46 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
47 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
48 |
CREATE TABLE Datetest( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
49 |
dt1 timestamp, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
50 |
dt2 timestamp, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
51 |
d1 date, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
52 |
d2 date, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
53 |
t1 time, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
54 |
t2 time |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
55 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
56 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
57 |
CREATE TABLE Division( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
58 |
name text |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
59 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
60 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
61 |
CREATE TABLE EPermission( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
62 |
name varchar(100) NOT NULL |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
63 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
64 |
CREATE INDEX epermission_name_idx ON EPermission(name); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
65 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
66 |
CREATE TABLE Eetype( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
67 |
name varchar(64) UNIQUE NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
68 |
description text, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
69 |
meta boolean, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
70 |
final boolean, |
10201
989bbadbcd8d
Add foreign key for inline relations
Julien Cristau <julien.cristau@logilab.fr>
parents:
10200
diff
changeset
|
71 |
initial_state integer REFERENCES entities (eid) |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
72 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
73 |
CREATE INDEX eetype_name_idx ON Eetype(name); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
74 |
CREATE INDEX eetype_initial_state_idx ON Eetype(initial_state); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
75 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
76 |
CREATE TABLE Employee( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
77 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
78 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
79 |
CREATE TABLE Note( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
80 |
date varchar(10), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
81 |
type varchar(1), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
82 |
para varchar(512) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
83 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
84 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
85 |
CREATE TABLE Person( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
86 |
nom varchar(64) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
87 |
prenom varchar(64), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
88 |
sexe varchar(1) DEFAULT 'M', |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
89 |
promo varchar(6), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
90 |
titre varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
91 |
adel varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
92 |
ass varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
93 |
web varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
94 |
tel integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
95 |
fax integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
96 |
datenaiss date, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
97 |
test boolean, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
98 |
salary float |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
99 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
100 |
CREATE UNIQUE INDEX unique_e6c2d219772dbf1715597f7d9a6b3892 ON Person(nom,prenom); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
101 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
102 |
CREATE TABLE Salaried( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
103 |
nom varchar(64) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
104 |
prenom varchar(64), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
105 |
sexe varchar(1) DEFAULT 'M', |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
106 |
promo varchar(6), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
107 |
titre varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
108 |
adel varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
109 |
ass varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
110 |
web varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
111 |
tel integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
112 |
fax integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
113 |
datenaiss date, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
114 |
test boolean, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
115 |
salary float |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
116 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
117 |
CREATE UNIQUE INDEX unique_98da0f9de8588baa8966f0b1a6f850a3 ON Salaried(nom,prenom); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
118 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
119 |
CREATE TABLE Societe( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
120 |
nom varchar(64), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
121 |
web varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
122 |
tel integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
123 |
fax integer, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
124 |
rncs varchar(32), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
125 |
ad1 varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
126 |
ad2 varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
127 |
ad3 varchar(128), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
128 |
cp varchar(12), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
129 |
ville varchar(32) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
130 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
131 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
132 |
CREATE TABLE State( |
10204
f8ccae1e271d
Add reference from etype table's eid column to the entities table
Julien Cristau <julien.cristau@logilab.fr>
parents:
10202
diff
changeset
|
133 |
eid integer PRIMARY KEY REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
134 |
name varchar(256) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
135 |
description text |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
136 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
137 |
CREATE INDEX state_name_idx ON State(name); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
138 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
139 |
CREATE TABLE Subcompany( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
140 |
name text |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
141 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
142 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
143 |
CREATE TABLE Subdivision( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
144 |
name text |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
145 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
146 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
147 |
CREATE TABLE pkginfo( |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
148 |
modname varchar(30) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
149 |
version varchar(10) DEFAULT '0.1' NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
150 |
copyright text NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
151 |
license varchar(3), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
152 |
short_desc varchar(80) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
153 |
long_desc text NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
154 |
author varchar(100) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
155 |
author_email varchar(100) NOT NULL, |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
156 |
mailinglist varchar(100), |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
157 |
debian_handler varchar(6) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
158 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
159 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
160 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
161 |
CREATE TABLE concerne_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
162 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
163 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
164 |
CONSTRAINT concerne_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
165 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
166 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
167 |
CREATE INDEX concerne_relation_from_idx ON concerne_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
168 |
CREATE INDEX concerne_relation_to_idx ON concerne_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
169 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
170 |
CREATE TABLE division_of_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
171 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
172 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
173 |
CONSTRAINT division_of_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
174 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
175 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
176 |
CREATE INDEX division_of_relation_from_idx ON division_of_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
177 |
CREATE INDEX division_of_relation_to_idx ON division_of_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
178 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
179 |
CREATE TABLE evaluee_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
180 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
181 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
182 |
CONSTRAINT evaluee_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
183 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
184 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
185 |
CREATE INDEX evaluee_relation_from_idx ON evaluee_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
186 |
CREATE INDEX evaluee_relation_to_idx ON evaluee_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
187 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
188 |
CREATE TABLE next_state_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
189 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
190 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
191 |
CONSTRAINT next_state_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
192 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
193 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
194 |
CREATE INDEX next_state_relation_from_idx ON next_state_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
195 |
CREATE INDEX next_state_relation_to_idx ON next_state_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
196 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
197 |
CREATE TABLE obj_wildcard_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
198 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
199 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
200 |
CONSTRAINT obj_wildcard_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
201 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
202 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
203 |
CREATE INDEX obj_wildcard_relation_from_idx ON obj_wildcard_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
204 |
CREATE INDEX obj_wildcard_relation_to_idx ON obj_wildcard_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
205 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
206 |
CREATE TABLE require_permission_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
207 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
208 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
209 |
CONSTRAINT require_permission_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
210 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
211 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
212 |
CREATE INDEX require_permission_relation_from_idx ON require_permission_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
213 |
CREATE INDEX require_permission_relation_to_idx ON require_permission_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
214 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
215 |
CREATE TABLE state_of_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
216 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
217 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
218 |
CONSTRAINT state_of_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
219 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
220 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
221 |
CREATE INDEX state_of_relation_from_idx ON state_of_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
222 |
CREATE INDEX state_of_relation_to_idx ON state_of_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
223 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
224 |
CREATE TABLE subcompany_of_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
225 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
226 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
227 |
CONSTRAINT subcompany_of_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
228 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
229 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
230 |
CREATE INDEX subcompany_of_relation_from_idx ON subcompany_of_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
231 |
CREATE INDEX subcompany_of_relation_to_idx ON subcompany_of_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
232 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
233 |
CREATE TABLE subdivision_of_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
234 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
235 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
236 |
CONSTRAINT subdivision_of_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
237 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
238 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
239 |
CREATE INDEX subdivision_of_relation_from_idx ON subdivision_of_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
240 |
CREATE INDEX subdivision_of_relation_to_idx ON subdivision_of_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
241 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
242 |
CREATE TABLE subj_wildcard_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
243 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
244 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
245 |
CONSTRAINT subj_wildcard_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
246 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
247 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
248 |
CREATE INDEX subj_wildcard_relation_from_idx ON subj_wildcard_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
249 |
CREATE INDEX subj_wildcard_relation_to_idx ON subj_wildcard_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
250 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
251 |
CREATE TABLE sym_rel_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
252 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
253 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
254 |
CONSTRAINT sym_rel_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
255 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
256 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
257 |
CREATE INDEX sym_rel_relation_from_idx ON sym_rel_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
258 |
CREATE INDEX sym_rel_relation_to_idx ON sym_rel_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
259 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
260 |
CREATE TABLE travaille_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
261 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
262 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
263 |
CONSTRAINT travaille_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
264 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
265 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
266 |
CREATE INDEX travaille_relation_from_idx ON travaille_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
267 |
CREATE INDEX travaille_relation_to_idx ON travaille_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
268 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
269 |
CREATE TABLE works_for_relation ( |
10202
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
270 |
eid_from INTEGER NOT NULL REFERENCES entities (eid), |
aaabcb64f77f
Use foreign keys for relations tables
Julien Cristau <julien.cristau@logilab.fr>
parents:
10201
diff
changeset
|
271 |
eid_to INTEGER NOT NULL REFERENCES entities (eid), |
10199
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
272 |
CONSTRAINT works_for_relation_p_key PRIMARY KEY(eid_from, eid_to) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
273 |
); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
274 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
275 |
CREATE INDEX works_for_relation_from_idx ON works_for_relation(eid_from); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
276 |
CREATE INDEX works_for_relation_to_idx ON works_for_relation(eid_to); |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
277 |
""" |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
278 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
279 |
class SQLSchemaTC(TestCase): |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
280 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
281 |
def test_known_values(self): |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
282 |
dbhelper = get_db_helper('postgres') |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
283 |
output = schema2sql.schema2sql(dbhelper, schema) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
284 |
self.assertMultiLineEqual(EXPECTED_DATA_NO_DROP.strip(), output.strip()) |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
285 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
286 |
|
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
287 |
if __name__ == '__main__': |
218c28bff695
Steal schema2sql module from yams
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff
changeset
|
288 |
unittest_main() |