-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateTablesIndexs.sql
91 lines (77 loc) · 2.09 KB
/
CreateTablesIndexs.sql
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Create Table mastermd5
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash nvarchar(32) not null collate nocase,
source nvarchar(256),
CDDid int
);
Create Table mastersha1
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash nvarchar(40) not null collate nocase,
source nvarchar(256),
CDDid int
);
Create Table mastersha5
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
hash nvarchar(64) not null collate nocase,
source nvarchar(256),
CDDid int
);
Create Table importedmd5
(
hash nvarchar(32) not null collate nocase,
path text
);
Create Table importedsha1
(
hash nvarchar(40) not null collate nocase,
path text
);
Create Table importedsha5
(
hash nvarchar(64) not null collate nocase,
path text
);
Create Table tempmaster
(
hash nvarchar(256) not null
);
Create Table templocal
(
hash nvarchar(256) not null, path text
);
Create View v_md5 as
Select importedmd5.hash, importedmd5.path
from importedmd5
join mastermd5 on mastermd5.hash = importedmd5.hash;
Create View v_sha1 as
Select importedsha1.hash, importedsha1.path
from importedsha1
join mastersha1 on mastersha1.hash = importedsha1.hash;
Create View v_sha5 as
Select importedsha5.hash, importedsha5.path
from importedsha5
join mastersha5 on mastersha5.hash = importedsha5.hash;
Create Unique Index idx_md5 on mastermd5 (hash);
Create Unique Index idx_sha1 on mastersha1 (hash);
Create Unique Index idx_sha5 on mastersha5 (hash);
Create Unique Index idx_imd5 on importedmd5 (hash);
Create Unique Index idx_isha1 on importedsha1 (hash);
Create Unique Index idx_isha5 on importedsha5 (hash);
/*
Select tempmaster.hash from tempmaster join mastermd5 on mastermd5.hash = tempmaster.hash;
drop table mastermd5;
drop table mastersha1;
drop table mastersha5;
drop table importedmd5;
drop table importedSHA1;
drop table importedsha5;
drop table tempmaster;
drop table templocal;
drop table mastertemp;
drop view v_md5;
drop view v_sha1;
drop view v_sha5;
*/