Commit | Line | Data |
407bc860 |
1 | #!/usr/local/bin/perl |
2 | # vim: set ft=perl: |
3 | |
4 | BEGIN { print "1..1\n" } |
5 | |
6 | my $create = q| |
7 | |
8 | -- The cvterm module design is based on the ontology |
9 | |
10 | -- ================================================ |
11 | -- TABLE: cv |
12 | -- ================================================ |
13 | |
14 | create table cv ( |
15 | cv_id serial not null, |
16 | primary key (cv_id), |
17 | cvname varchar not null, |
18 | cvdefinition text, |
19 | |
20 | unique(cvname) |
21 | ); |
22 | |
23 | -- ================================================ |
24 | -- TABLE: cvterm |
25 | -- ================================================ |
26 | |
27 | create table cvterm ( |
28 | cvterm_id serial not null, |
29 | primary key (cvterm_id), |
30 | cv_id int not null, |
31 | foreign key (cv_id) references cv (cv_id), |
32 | name varchar(255) not null, |
33 | termdefinition text, |
34 | -- the primary dbxref for this term. Other dbxrefs may be cvterm_dbxref |
35 | dbxref_id int, |
36 | foreign key (dbxref_id) references dbxref (dbxref_id), |
37 | |
38 | unique(termname, cv_id) |
39 | ); |
40 | create index cvterm_idx1 on cvterm (cv_id); |
41 | |
42 | |; |
43 | #-- The unique key on termname, termtype_id ensures that all terms are |
44 | #-- unique within a given cv |
45 | |
46 | use SQL::Translator; |
47 | use Data::Dumper; |
48 | |
49 | $SQL::Translator::DEBUG = 1; |
50 | |
51 | my $tr = SQL::Translator->new(parser => "PostgreSQL", |
52 | producer => "MySQL" |
53 | #producer => "SQL::Translator::Producer::MySQL::translate" |
54 | #producer => sub { Dumper($_[1]) } |
55 | ); |
56 | |
57 | print "not " unless ($tr->translate(\$create)); |
58 | print "ok 1 # pointless test -- plz fix me!\n"; |
59 | |
60 | __END__ |
61 | __DATA__ |
62 | |
63 | -- The cvterm module design is based on the ontology |
64 | |
65 | -- ================================================ |
66 | -- TABLE: cv |
67 | -- ================================================ |
68 | |
69 | create table cv ( |
70 | cv_id serial not null, |
71 | primary key (cv_id), |
72 | cvname varchar not null, |
73 | cvdefinition text, |
74 | |
75 | unique(cvname) |
76 | ); |
77 | |
78 | -- ================================================ |
79 | -- TABLE: cvterm |
80 | -- ================================================ |
81 | |
82 | create table cvterm ( |
83 | cvterm_id serial not null, |
84 | primary key (cvterm_id), |
85 | cv_id int not null, |
86 | foreign key (cv_id) references cv (cv_id), |
87 | name varchar(255) not null, |
88 | termdefinition text, |
89 | -- the primary dbxref for this term. Other dbxrefs may be cvterm_dbxref |
90 | dbxref_id int, |
91 | foreign key (dbxref_id) references dbxref (dbxref_id), |
92 | |
93 | unique(termname, cv_id) |
94 | -- The unique key on termname, termtype_id ensures that all terms are |
95 | -- unique within a given cv |
96 | ); |
97 | create index cvterm_idx1 on cvterm (cv_id); |
98 | |
99 | |
100 | -- ================================================ |
101 | -- TABLE: cvrelationship |
102 | -- ================================================ |
103 | |
104 | create table cvrelationship ( |
105 | cvrelationship_id serial not null, |
106 | primary key (cvrelationship_id), |
107 | reltype_id int not null, |
108 | foreign key (reltype_id) references cvterm (cvterm_id), |
109 | subjterm_id int not null, |
110 | foreign key (subjterm_id) references cvterm (cvterm_id), |
111 | objterm_id int not null, |
112 | foreign key (objterm_id) references cvterm (cvterm_id), |
113 | |
114 | unique(reltype_id, subjterm_id, objterm_id) |
115 | ); |
116 | create index cvrelationship_idx1 on cvrelationship (reltype_id); |
117 | create index cvrelationship_idx2 on cvrelationship (subjterm_id); |
118 | create index cvrelationship_idx3 on cvrelationship (objterm_id); |
119 | |
120 | |
121 | -- ================================================ |
122 | -- TABLE: cvpath |
123 | -- ================================================ |
124 | |
125 | create table cvpath ( |
126 | cvpath_id serial not null, |
127 | primary key (cvpath_id), |
128 | reltype_id int, |
129 | foreign key (reltype_id) references cvterm (cvterm_id), |
130 | subjterm_id int not null, |
131 | foreign key (subjterm_id) references cvterm (cvterm_id), |
132 | objterm_id int not null, |
133 | foreign key (objterm_id) references cvterm (cvterm_id), |
134 | cv_id int not null, |
135 | foreign key (cv_id) references cv (cv_id), |
136 | pathdistance int, |
137 | |
138 | unique (subjterm_id, objterm_id) |
139 | ); |
140 | create index cvpath_idx1 on cvpath (reltype_id); |
141 | create index cvpath_idx2 on cvpath (subjterm_id); |
142 | create index cvpath_idx3 on cvpath (objterm_id); |
143 | create index cvpath_idx4 on cvpath (cv_id); |
144 | |
145 | |
146 | -- ================================================ |
147 | -- TABLE: cvtermsynonym |
148 | -- ================================================ |
149 | |
150 | create table cvtermsynonym ( |
151 | cvterm_id int not null, |
152 | foreign key (cvterm_id) references cvterm (cvterm_id), |
153 | termsynonym varchar(255) not null, |
154 | |
155 | unique(cvterm_id, termsynonym) |
156 | ); |
157 | create index cvterm_synonym_idx1 on cvterm_synonym (cvterm_id); |
158 | |
159 | -- ================================================ |
160 | -- TABLE: cvterm_dbxref |
161 | -- ================================================ |
162 | |
163 | create table cvterm_dbxref ( |
164 | cvterm_dbxref_id serial not null, |
165 | primary key (cvterm_dbxref_id), |
166 | cvterm_id int not null, |
167 | foreign key (cvterm_id) references cvterm (cvterm_id), |
168 | dbxref_id int not null, |
169 | foreign key (dbxref_id) references dbxref (dbxref_id), |
170 | |
171 | unique(cvterm_id, dbxref_id) |
172 | ); |
173 | create index cvterm_dbxref_idx1 on cvterm_dbxref (cvterm_id); |
174 | create index cvterm_dbxref_idx2 on cvterm_dbxref (dbxref_id); |
175 | |