-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
database_1-3.sql
50 lines (48 loc) · 1.12 KB
/
database_1-3.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
-- USE THIS SCRIPT ONLY WHEN YOU !!!UPDATE!!! older version (<1.3) of the TODOMATOR app
-- You must run this script before the app runs.
-- How to obtain the current version? Open /definitions/init.js file and find "CONF.version".
DROP VIEW view_ticket;
ALTER TABLE tbl_ticket ALTER COLUMN ispriority DROP DEFAULT;
ALTER TABLE tbl_ticket ALTER ispriority TYPE INT2 USING 0;
ALTER TABLE tbl_ticket ALTER COLUMN ispriority SET DEFAULT 0;
CREATE VIEW view_ticket AS
SELECT a.id,
a.folderid,
a.ownerid,
a.statusid,
a.parentid,
a.userid,
a.name,
a.worked,
a.estimate,
a.comments,
a.ispriority,
b.name AS folder,
b.color AS folder_color,
b.icon AS folder_icon,
a.attachments,
a.tags,
a.date,
a.dtstatus,
a.dtupdated,
a.deadline,
a.isbillable,
d.name AS status,
d.sortindex,
d.color AS status_color,
a.search,
b.isprivate,
a.html,
a.dtparent,
a.dtcreated,
a.reference,
a.source,
a.markdown,
a.ispublic,
d.icon AS status_icon,
a.note,
a.watcherid
FROM tbl_ticket a
LEFT JOIN tbl_folder b ON b.id = a.folderid
LEFT JOIN cl_status d ON d.id = a.statusid
WHERE a.isremoved = false;