Skip to content

Commit 0518045

Browse files
authored
Merge branch 'master' into patch-1
2 parents 73fd860 + ec69680 commit 0518045

File tree

1 file changed

+95
-95
lines changed

1 file changed

+95
-95
lines changed

legi/sql/schema.sql

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,140 @@
11

22
CREATE TABLE db_meta
3-
( key char(30) primary key
4-
, value blob
3+
( key char(30) primary key
4+
, value blob
55
);
66

77
INSERT INTO db_meta (key, value) VALUES ('schema_version', 2);
88

99
CREATE TABLE textes
10-
( id integer primary key not null
11-
, nature text not null
12-
, num text
13-
, nor char(12) unique -- only used during factorization
14-
, titrefull_s text unique -- only used during factorization
10+
( id integer primary key not null
11+
, nature text not null
12+
, num text
13+
, nor char(12) unique -- only used during factorization
14+
, titrefull_s text unique -- only used during factorization
1515
, UNIQUE (nature, num)
1616
);
1717

1818
CREATE TABLE textes_structs
19-
( id char(20) unique not null
20-
, versions text
21-
, dossier text not null
22-
, cid char(20) not null
23-
, mtime int not null
19+
( id char(20) unique not null
20+
, versions text
21+
, dossier text not null
22+
, cid char(20) not null
23+
, mtime int not null
2424
);
2525

2626
CREATE TABLE textes_versions
27-
( id char(20) unique not null
28-
, nature text
29-
, titre text
30-
, titrefull char(40)
31-
, titrefull_s char(40)
32-
, etat text
33-
, date_debut day
34-
, date_fin day
35-
, autorite text
36-
, ministere text
37-
, num text
38-
, num_sequence int
39-
, nor char(12)
40-
, date_publi day
41-
, date_texte day
42-
, derniere_modification day
43-
, origine_publi text
44-
, page_deb_publi int
45-
, page_fin_publi int
46-
, visas text
47-
, signataires text
48-
, tp text
49-
, nota text
50-
, abro text
51-
, rect text
52-
, dossier text not null
53-
, cid char(20) not null
54-
, mtime int not null
55-
, texte_id int references textes
27+
( id char(20) unique not null
28+
, nature text
29+
, titre text
30+
, titrefull char(40)
31+
, titrefull_s char(40)
32+
, etat text
33+
, date_debut day
34+
, date_fin day
35+
, autorite text
36+
, ministere text
37+
, num text
38+
, num_sequence int
39+
, nor char(12)
40+
, date_publi day
41+
, date_texte day
42+
, derniere_modification day
43+
, origine_publi text
44+
, page_deb_publi int
45+
, page_fin_publi int
46+
, visas text
47+
, signataires text
48+
, tp text
49+
, nota text
50+
, abro text
51+
, rect text
52+
, dossier text not null
53+
, cid char(20) not null
54+
, mtime int not null
55+
, texte_id int references textes
5656
);
5757

5858
CREATE INDEX textes_versions_titrefull_s ON textes_versions (titrefull_s);
5959
CREATE INDEX textes_versions_texte_id ON textes_versions (texte_id);
6060

6161
CREATE TABLE sections
62-
( id char(20) unique not null
63-
, titre_ta text
64-
, commentaire text
65-
, parent char(20) -- REFERENCES sections(id)
66-
, dossier text not null
67-
, cid char(20) not null
68-
, mtime int not null
62+
( id char(20) unique not null
63+
, titre_ta text
64+
, commentaire text
65+
, parent char(20) -- REFERENCES sections(id)
66+
, dossier text not null
67+
, cid char(20) not null
68+
, mtime int not null
6969
);
7070

7171
CREATE TABLE articles
72-
( id char(20) unique not null
73-
, section char(20) -- REFERENCES sections(id)
74-
, num text
75-
, etat text
76-
, date_debut day
77-
, date_fin day
78-
, type text
79-
, nota text
80-
, bloc_textuel text
81-
, dossier text not null
82-
, cid char(20) not null
83-
, mtime int not null
72+
( id char(20) unique not null
73+
, section char(20) -- REFERENCES sections(id)
74+
, num text
75+
, etat text
76+
, date_debut day
77+
, date_fin day
78+
, type text
79+
, nota text
80+
, bloc_textuel text
81+
, dossier text not null
82+
, cid char(20) not null
83+
, mtime int not null
8484
);
8585

8686
CREATE TABLE sommaires
87-
( cid char(20) not null
88-
, parent char(20) -- REFERENCES sections
89-
, element char(20) not null -- REFERENCES articles OR sections
90-
, debut day
91-
, fin day
92-
, etat text
93-
, num text
94-
, position int
95-
, _source text -- to support incremental updates
87+
( cid char(20) not null
88+
, parent char(20) -- REFERENCES sections
89+
, element char(20) not null -- REFERENCES articles OR sections
90+
, debut day
91+
, fin day
92+
, etat text
93+
, num text
94+
, position int
95+
, _source text -- to support incremental updates
9696
);
9797

9898
CREATE INDEX sommaires_cid_idx ON sommaires (cid);
9999

100100
CREATE TABLE liens
101-
( src_id char(20) not null
102-
, dst_cid char(20)
103-
, dst_id char(20)
104-
, dst_titre text
105-
, typelien text
106-
, _reversed bool -- to support incremental updates
101+
( src_id char(20) not null
102+
, dst_cid char(20)
103+
, dst_id char(20)
104+
, dst_titre text
105+
, typelien text
106+
, _reversed bool -- to support incremental updates
107107
, CHECK (length(dst_cid) > 0 OR length(dst_id) > 0 OR length(dst_titre) > 0)
108108
);
109109

110110
CREATE INDEX liens_src_idx ON liens (src_id) WHERE NOT _reversed;
111111
CREATE INDEX liens_dst_idx ON liens (dst_id) WHERE _reversed;
112112

113113
CREATE TABLE duplicate_files
114-
( id char(20) not null
115-
, sous_dossier text not null
116-
, cid char(20) not null
117-
, dossier text not null
118-
, mtime int not null
119-
, data text not null
120-
, other_cid char(20) not null
121-
, other_dossier text not null
122-
, other_mtime int not null
114+
( id char(20) not null
115+
, sous_dossier text not null
116+
, cid char(20) not null
117+
, dossier text not null
118+
, mtime int not null
119+
, data text not null
120+
, other_cid char(20) not null
121+
, other_dossier text not null
122+
, other_mtime int not null
123123
, UNIQUE (id, sous_dossier, cid, dossier)
124124
);
125125

126126
CREATE TABLE textes_versions_brutes
127-
( id char(20) unique not null
128-
, bits int not null
129-
, nature text
130-
, titre text
131-
, titrefull text
132-
, autorite text
133-
, num text
134-
, date_texte day
135-
, dossier text not null
136-
, cid char(20) not null
137-
, mtime int not null
127+
( id char(20) unique not null
128+
, bits int not null
129+
, nature text
130+
, titre text
131+
, titrefull text
132+
, autorite text
133+
, num text
134+
, date_texte day
135+
, dossier text not null
136+
, cid char(20) not null
137+
, mtime int not null
138138
);
139139

140140
CREATE VIEW textes_versions_brutes_view AS

0 commit comments

Comments
 (0)