-
Notifications
You must be signed in to change notification settings - Fork 68
/
alter_tables.sql
159 lines (123 loc) · 4.52 KB
/
alter_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
# if you would like to utilize a table prefix when upgrading these tables, be sure to use the one you have setup in config.inc.php.
# this option is $db_prefix. if you are unaware of what is meant by utilizing a 'table prefix', then please disregard.
###################################################################
# #
# If upgrading from version 1.01 or 1.0, run these sql statements #
# below on the PHP Timeclock database. #
# #
###################################################################
#
# Table structure for table `audit`
#
CREATE TABLE audit (
modified_by_ip VARCHAR(39) NOT NULL DEFAULT '',
modified_by_user VARCHAR(50) NOT NULL DEFAULT '',
modified_when BIGINT(14) NOT NULL,
modified_from BIGINT(14) NOT NULL,
modified_to BIGINT(14) NOT NULL,
modified_why VARCHAR(250) NOT NULL DEFAULT '',
user_modified VARCHAR(50) NOT NULL DEFAULT '',
PRIMARY KEY (modified_when),
UNIQUE KEY modified_when (modified_when)
) TYPE = MyISAM;
# --------------------------------------------------------
#
# dbversion table
#
UPDATE `dbversion`
SET `dbversion` = '1.4';
# --------------------------------------------------------
#
# info table
#
ALTER TABLE `info` ADD `ipaddress` VARCHAR(39) NOT NULL DEFAULT '';
# --------------------------------------------------------
#
# employees table
#
ALTER TABLE `employees` ADD `disabled` TINYINT(1) NOT NULL DEFAULT '0';
# --------------------------------------------------------
########################################################################
# #
# If upgrading from version 0.9.4-1 or 0.9.4, run these sql statements #
# below on the PHP Timeclock database. #
# #
########################################################################
#
# Table structure for table `audit`
#
CREATE TABLE audit (
modified_by VARCHAR(50) NOT NULL DEFAULT '',
modified_when BIGINT(14) NOT NULL,
modified_from BIGINT(14) NOT NULL,
modified_to BIGINT(14) NOT NULL,
modified_why VARCHAR(250) NOT NULL DEFAULT '',
PRIMARY KEY (modified_when),
UNIQUE KEY modified_when (modified_when)
) TYPE = MyISAM;
# --------------------------------------------------------
#
# dbversion table
#
UPDATE `dbversion`
SET `dbversion` = '1.4';
# --------------------------------------------------------
#
# employees table
#
ALTER TABLE `employees` ADD `displayname` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `employees` ADD `email` VARCHAR(75) NOT NULL DEFAULT '';
ALTER TABLE `employees` ADD `groups` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `employees` ADD `office` VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE `employees` ADD `admin` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `employees` ADD `reports` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `employees` ADD `time_admin` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `employees` ADD `disabled` TINYINT(1) NOT NULL DEFAULT '0';
INSERT INTO employees VALUES ('admin', NULL, 'xy.RY2HT1QTc2', 'administrator', '', '', '', 1, 1, 1, '');
# --------------------------------------------------------
#
# groups table
#
CREATE TABLE groups (
groupname VARCHAR(50) NOT NULL DEFAULT '',
groupid INT(10) NOT NULL AUTO_INCREMENT,
officeid INT(10) NOT NULL DEFAULT '0',
PRIMARY KEY (groupid)
) TYPE = MyISAM;
# --------------------------------------------------------
#
# info table
#
ALTER TABLE `info` CHANGE `inout` `inout` VARCHAR(50) NOT NULL;
ALTER TABLE `info` ADD `ipaddress` VARCHAR(39) NOT NULL DEFAULT '';
# --------------------------------------------------------
#
# offices table
#
CREATE TABLE offices (
officename VARCHAR(50) NOT NULL DEFAULT '',
officeid INT(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (officeid)
) TYPE = MyISAM;
# --------------------------------------------------------
#
# punchlist table
#
ALTER TABLE `punchlist` CHANGE `punchitems` `punchitems` VARCHAR(50) NOT NULL;
ALTER TABLE `punchlist` ADD `in_or_out` TINYINT(1) DEFAULT '0' NOT NULL;
UPDATE `punchlist`
SET `in_or_out` = '1'
WHERE `punchitems` = 'in'
LIMIT 1;
UPDATE `punchlist`
SET `in_or_out` = '0'
WHERE `punchitems` = 'out'
LIMIT 1;
UPDATE `punchlist`
SET `in_or_out` = '0'
WHERE `punchitems` = 'break'
LIMIT 1;
UPDATE `punchlist`
SET `in_or_out` = '0'
WHERE `punchitems` = 'lunch'
LIMIT 1;