-
Notifications
You must be signed in to change notification settings - Fork 11
/
create_tables.sql
186 lines (154 loc) · 4.97 KB
/
create_tables.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
-- AvantFAX 3.2.0 MySQL structure
-- Distribution Lists
CREATE TABLE IF NOT EXISTS DistroList (
dl_id INT auto_increment KEY,
listname VARCHAR(255) NOT NULL,
listdata TEXT,
lastmod_date TIMESTAMP,
lastmod_user INT
) DEFAULT CHARACTER SET utf8;
-- MODEMS
CREATE TABLE IF NOT EXISTS Modems (
devid INT auto_increment KEY,
device VARCHAR(10) NOT NULL,
alias VARCHAR(40),
contact VARCHAR(100),
printer VARCHAR(100),
faxcatid INT
) DEFAULT CHARACTER SET utf8;
-- COVER PAGES
CREATE TABLE IF NOT EXISTS CoverPages (
cover_id INT auto_increment KEY,
title VARCHAR(64) NOT NULL,
file VARCHAR(255) NOT NULL
) DEFAULT CHARACTER SET utf8;
-- USER INFORMATION
-- password is md5 hash and always 32 chars
CREATE TABLE IF NOT EXISTS UserAccount (
uid INT auto_increment KEY,
name VARCHAR(40),
username VARCHAR(40) NOT NULL,
password VARCHAR(32) NOT NULL,
email VARCHAR(99) NOT NULL,
email_sig TEXT,
user_tsi VARCHAR(100),
from_company VARCHAR(150),
from_location VARCHAR(150),
from_voicenumber VARCHAR(150),
from_faxnumber VARCHAR(150),
coverpage_id INT,
audiofile VARCHAR(50) NULL,
faxperpageinbox INT,
faxperpagearchive INT,
superuser BOOL DEFAULT FALSE,
can_del BOOL DEFAULT FALSE,
last_mod TIMESTAMP,
last_login TIMESTAMP,
last_ip VARCHAR(15),
language VARCHAR(5),
modemdevs TEXT,
didrouting TEXT,
faxcats TEXT,
pwdexpire DATE,
pwdcycle INT DEFAULT 0,
pwd_reuse BOOL DEFAULT FALSE,
is_admin BOOL DEFAULT FALSE,
wasreset BOOL DEFAULT FALSE,
acc_enabled BOOL DEFAULT TRUE,
deleted BOOL DEFAULT FALSE,
any_modem BOOL DEFAULT FALSE
) DEFAULT CHARACTER SET utf8;
-- store hashes of passwords already used for a user
CREATE TABLE IF NOT EXISTS UserPasswords (
upid INT auto_increment KEY,
uid INT NOT NULL,
pwdhash VARCHAR (32) NOT NULL
) DEFAULT CHARACTER SET utf8;
-- AddressBook table
CREATE TABLE IF NOT EXISTS AddressBook (
abook_id INT auto_increment KEY,
company VARCHAR(255)
) DEFAULT CHARACTER SET utf8;
CREATE TABLE IF NOT EXISTS AddressBookEmail (
abookemail_id INT auto_increment KEY,
abook_id INT,
contact_name VARCHAR(255),
contact_email VARCHAR(255) NOT NULL
) DEFAULT CHARACTER SET utf8;
CREATE TABLE IF NOT EXISTS AddressBookFAX (
abookfax_id INT auto_increment KEY,
abook_id INT,
faxnumber VARCHAR(20) NOT NULL,
email VARCHAR(100),
description VARCHAR(30),
to_person VARCHAR(150),
to_location VARCHAR(150),
to_voicenumber VARCHAR(150),
faxcatid INT,
faxfrom INT DEFAULT 0,
faxto INT DEFAULT 0,
printer VARCHAR(100)
) DEFAULT CHARACTER SET utf8;
-- DID Routing
CREATE TABLE IF NOT EXISTS DIDRoute (
didr_id INT auto_increment KEY,
routecode VARCHAR(10) NOT NULL,
alias VARCHAR(40),
contact VARCHAR(100),
printer VARCHAR(100),
faxcatid INT
) DEFAULT CHARACTER SET utf8;
-- Barcode Route
CREATE TABLE IF NOT EXISTS BarcodeRoute (
barcode_id INT auto_increment KEY,
barcode TEXT,
alias VARCHAR(40),
contact VARCHAR(100),
printer VARCHAR(100),
faxcatid INT
) DEFAULT CHARACTER SET utf8;
-- ARCHIVE
-- companyid for outgoing faxes
CREATE TABLE IF NOT EXISTS FaxArchive (
fid INT auto_increment KEY,
faxnumid INT,
companyid INT,
faxpath VARCHAR(255) NOT NULL,
pages INT,
faxcatid INT,
didr_id INT,
description TEXT,
lastoperation TIMESTAMP,
lastmoduser INT,
lastmoddate TIMESTAMP,
archstamp TIMESTAMP,
modemdev VARCHAR(10),
userid INT,
origfaxnum VARCHAR(20),
faxcontent TEXT,
inbox BOOL DEFAULT TRUE
) DEFAULT CHARACTER SET utf8;
CREATE TABLE IF NOT EXISTS FaxCategory (
catid INT auto_increment KEY,
name VARCHAR(30)
) DEFAULT CHARACTER SET utf8;
-- AvantFAX System Log
CREATE TABLE IF NOT EXISTS SysLog (
syslogid INT auto_increment KEY,
logdate TIMESTAMP,
logtext TEXT
) DEFAULT CHARACTER SET utf8;
-- DynConf table for Blacklisting
CREATE TABLE IF NOT EXISTS DynConf (
dynconf_id INT auto_increment KEY,
device VARCHAR(20),
callid VARCHAR(100)
) DEFAULT CHARACTER SET utf8;
INSERT INTO UserAccount SET name='AvantFAX Admin', username='admin', password='5f4dcc3b5aa765d61d8327deb882cf99', wasreset=TRUE, email='root@localhost', is_admin = TRUE, language = 'en', acc_enabled = TRUE, any_modem = TRUE, superuser = TRUE;
INSERT INTO UserPasswords SET uid=1, pwdhash='5f4dcc3b5aa765d61d8327deb882cf99';
INSERT INTO AddressBook SET company = 'XXXXXXX';
INSERT INTO AddressBookFAX SET abook_id = 1, faxnumber = 'XXXXXXX';
INSERT INTO CoverPages SET title='Generic A4', file='cover.ps';
INSERT INTO CoverPages SET title='Generic Letter', file='cover-letter.ps';
INSERT INTO CoverPages SET title='Generic HTML', file='coverpage.html';
-- SHOW TABLES;