-
Notifications
You must be signed in to change notification settings - Fork 3
/
database.EXAMPLE.php
78 lines (73 loc) · 1.65 KB
/
database.EXAMPLE.php
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
<?php
// Model database configuration file including a migration script.
// Edit this, especially the values IN CAPS, and rename it to database.php in the same directory
// See also settings.EXAMPLE.php
// Database connection
$db_settings = array(
'host' => 'DBHOST.LIBRARY.EXAMPLE.EDU',
'user' => 'DBUSER',
'password' => 'S3CR3T',
'name' => 'calendar', //no need to modify this without good reason
'tables' => array(
'hours' => 'libhrs', //no need to modify this without good reason
),
);
/*
** === Migrating ===
** If you want to migrate data from your old calendar from Andrew Darby's Google Calendar tool (on which this tool was derived),
use this SQL.
-- Remember to substitute the database(s) and table names. Do a practice run on some backup tables first.
-- It will probably throw some warnings, but that's all they are, the data seems to convert just fine.
INSERT INTO db2.table2 (id, day, opens, closes)
SELECT libhours_id,
DATE(ymd),
IF(
is_closed=1,
NULL,
TIMESTAMP(
CONCAT_WS(
' ',
ymd,
REPLACE(
IF(
opening RLIKE 'pm',
ADDTIME(
REPLACE(opening,'pm',':00'),
'12:00:00'
),
opening
),
' ',
''
)
)
)
),
IF(
is_closed=1,
NULL,
TIMESTAMP(
CONCAT_WS(
' ',
ymd,
REPLACE(
if(
closing RLIKE 'pm',
ADDTIME(
REPLACE(closing,'pm',':00'),
'12:00:00'
),
closing
),
' ',
''
)
)
)
)
FROM db1.table1
WHERE libhours_id IN ( -- ** this satisfies the new unique day field constraint
SELECT MAX(libhours_id) FROM db1.table1 GROUP BY ymd
)
;
*/