-
Notifications
You must be signed in to change notification settings - Fork 383
/
Copy pathupgrade-0.6.8-0.6.9.sql
196 lines (189 loc) · 9.33 KB
/
upgrade-0.6.8-0.6.9.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
187
188
189
190
191
192
193
194
195
196
INSERT INTO "acl_links" ("created", "modified", "name", "url", "method", "slug", "group_id", "is_user_action", "is_guest_action", "is_admin_action", "is_hide") values ('now()', 'now()', 'Card search with Custom Field', '/cards/search', 'GET', 'view_card_search_custom_field', '3', '1', '0', '1', '0');
INSERT INTO "acl_links_roles" ("created", "modified", "acl_link_id", "role_id") VALUES
(now(), now(), (select id from acl_links where slug='view_card_search_custom_field'), '1'),
(now(), now(), (select id from acl_links where slug='view_card_search_custom_field'), '2');
UPDATE "users" SET "is_intro_video_skipped" = '0';
DO $$
BEGIN
BEGIN
ALTER TABLE "cards" ADD "cover_image_id" bigint NULL;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column cover_image_id already exists in cards';
END;
END;
$$;
CREATE OR REPLACE VIEW "cards_listing" AS
SELECT cards.id,
to_char(cards.created, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS created,
to_char(cards.modified, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS modified,
cards.board_id,
cards.list_id,
cards.name,
cards.description,
to_char(cards.due_date, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS due_date,
to_date(to_char(cards.due_date, 'YYYY/MM/DD'::text), 'YYYY/MM/DD'::text) AS to_date,
cards."position",
(cards.is_archived)::integer AS is_archived,
cards.attachment_count,
cards.checklist_count,
cards.checklist_item_count,
cards.checklist_item_completed_count,
cards.label_count,
cards.cards_user_count,
cards.cards_subscriber_count,
cards.card_voter_count,
cards.activity_count,
cards.user_id,
cards.name AS title,
cards.due_date AS start,
cards.due_date AS "end",
( SELECT array_to_json(array_agg(row_to_json(cc.*))) AS array_to_json
FROM ( SELECT checklists_listing.id,
checklists_listing.created,
checklists_listing.modified,
checklists_listing.user_id,
checklists_listing.card_id,
checklists_listing.name,
checklists_listing.checklist_item_count,
checklists_listing.checklist_item_completed_count,
checklists_listing."position",
checklists_listing.checklists_items
FROM checklists_listing checklists_listing
WHERE (checklists_listing.card_id = cards.id)
ORDER BY checklists_listing.id) cc) AS cards_checklists,
( SELECT array_to_json(array_agg(row_to_json(cc.*))) AS array_to_json
FROM ( SELECT cards_users_listing.username,
cards_users_listing.profile_picture_path,
cards_users_listing.id,
cards_users_listing.created,
cards_users_listing.modified,
cards_users_listing.card_id,
cards_users_listing.user_id,
cards_users_listing.initials,
cards_users_listing.full_name,
cards_users_listing.email
FROM cards_users_listing cards_users_listing
WHERE (cards_users_listing.card_id = cards.id)
ORDER BY cards_users_listing.id) cc) AS cards_users,
( SELECT array_to_json(array_agg(row_to_json(cv.*))) AS array_to_json
FROM ( SELECT card_voters_listing.id,
card_voters_listing.created,
card_voters_listing.modified,
card_voters_listing.user_id,
card_voters_listing.card_id,
card_voters_listing.username,
card_voters_listing.role_id,
card_voters_listing.profile_picture_path,
card_voters_listing.initials,
card_voters_listing.full_name
FROM card_voters_listing card_voters_listing
WHERE (card_voters_listing.card_id = cards.id)
ORDER BY card_voters_listing.id) cv) AS cards_voters,
( SELECT array_to_json(array_agg(row_to_json(cs.*))) AS array_to_json
FROM ( SELECT cards_subscribers.id,
to_char(cards_subscribers.created, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS created,
to_char(cards_subscribers.modified, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS modified,
cards_subscribers.card_id,
cards_subscribers.user_id,
(cards_subscribers.is_subscribed)::integer AS is_subscribed
FROM card_subscribers cards_subscribers
WHERE (cards_subscribers.card_id = cards.id)
ORDER BY cards_subscribers.id) cs) AS cards_subscribers,
( SELECT array_to_json(array_agg(row_to_json(cl.*))) AS array_to_json
FROM ( SELECT cards_labels.label_id,
cards_labels.id,
cards_labels.card_id,
cards_labels.list_id,
cards_labels.board_id,
cards_labels.name,
cards_labels.color
FROM cards_labels_listing cards_labels
WHERE (cards_labels.card_id = cards.id)
ORDER BY cards_labels.id) cl) AS cards_labels,
cards.comment_count,
u.username,
b.name AS board_name,
l.name AS list_name,
cards.custom_fields,
cards.color,
cards.due_date AS notification_due_date,
cards.is_due_date_notification_sent,
cards.archived_date,
to_char(( SELECT activities.created
FROM activities
WHERE ((activities.card_id = cards.id) AND ((activities.type)::text = 'move_card'::text))
ORDER BY activities.id DESC
LIMIT 1), 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS list_moved_date,
u.full_name AS card_created_user,
cards.cover_image_id
FROM (((cards cards
LEFT JOIN users u ON ((u.id = cards.user_id)))
LEFT JOIN boards b ON ((b.id = cards.board_id)))
LEFT JOIN lists l ON ((l.id = cards.list_id)));
CREATE OR REPLACE VIEW "lists_listing" AS
SELECT lists.id,
to_char(lists.created, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS created,
to_char(lists.modified, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS modified,
lists.board_id,
lists.name,
lists."position",
(lists.is_archived)::integer AS is_archived,
lists.card_count,
lists.lists_subscriber_count,
( SELECT array_to_json(array_agg(row_to_json(lc.*))) AS array_to_json
FROM ( SELECT cards_listing.id,
cards_listing.created,
cards_listing.modified,
cards_listing.board_id,
cards_listing.list_id,
cards_listing.name,
cards_listing.description,
cards_listing.due_date,
cards_listing.to_date,
cards_listing."position",
((cards_listing.is_archived)::boolean)::integer AS is_archived,
cards_listing.attachment_count,
cards_listing.checklist_count,
cards_listing.checklist_item_count,
cards_listing.checklist_item_completed_count,
cards_listing.label_count,
cards_listing.cards_user_count,
cards_listing.cards_subscriber_count,
cards_listing.card_voter_count,
cards_listing.activity_count,
cards_listing.user_id,
cards_listing.title,
cards_listing.start,
cards_listing."end",
cards_listing.cards_checklists,
cards_listing.cards_users,
cards_listing.cards_voters,
cards_listing.cards_subscribers,
cards_listing.cards_labels,
cards_listing.comment_count,
cards_listing.custom_fields,
cards_listing.color,
cards_listing.due_date AS notification_due_date,
cards_listing.is_due_date_notification_sent,
cards_listing.archived_date,
cards_listing.list_moved_date,
cards_listing.card_created_user,
cards_listing.cover_image_id
FROM cards_listing cards_listing
WHERE (cards_listing.list_id = lists.id)
ORDER BY cards_listing."position") lc) AS cards,
( SELECT array_to_json(array_agg(row_to_json(ls.*))) AS array_to_json
FROM ( SELECT lists_subscribers.id,
to_char(lists_subscribers.created, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS created,
to_char(lists_subscribers.modified, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS modified,
lists_subscribers.list_id,
lists_subscribers.user_id,
(lists_subscribers.is_subscribed)::integer AS is_subscribed
FROM list_subscribers lists_subscribers
WHERE (lists_subscribers.list_id = lists.id)
ORDER BY lists_subscribers.id) ls) AS lists_subscribers,
lists.custom_fields,
lists.color
FROM lists lists;
UPDATE "acl_board_links" SET "is_hide" = '0' WHERE "slug" = 'add_labels';
UPDATE "acl_board_links" SET "name" = 'Delete Labels' WHERE "slug" = 'delete_labels';