forked from samv/git-p4raw
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnormalized_tables.sql
More file actions
47 lines (40 loc) · 1.12 KB
/
normalized_tables.sql
File metadata and controls
47 lines (40 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Example & Tests
create table testtable
(
id int
, path1 text
, path2 text
, change int
);
insert into testtable values ( 1, '//depot/one','//depot/one', 10);
insert into testtable values ( 1, '//depot/two','//depot/three', 100);
alter table testtable alter column path1 type integer using create_or_find_depotpaths(path1);
alter table testtable alter column path2 type integer;
insert into testtable values ( 2, '//depot/one/two/three','//depot/one/2/3', 10);
insert into testtable values ( 2, '//depot/two/three','//depot/three/2/3', 100);
*/
/* produciton change */
-- alter table revcx alter column depotpath type integer using create_or_find_depotpaths(depotpath);
/* depot paths */
create table depotpaths
(
depotpaths_id serial primary key
, depotpath text
, hash int
);
create index depotpaths_hash on depotpaths(hash) ;
create index unique depotpaths_depotpath on depotpaths(depotpath);
/*
*
* label tags
*
*/
-- NEW.tagname := create_or_find_tagname(NEW.tagname);
create table tagnames
(
tagname_id serial primary key
, tagname text
, hash int
);
create index tagname_hash on tagnames(hash) ;