-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathupgrade-0.6.1-0.6.2.sql
106 lines (104 loc) · 4.58 KB
/
upgrade-0.6.1-0.6.2.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
INSERT INTO "acl_links_roles" ("created", "modified", "acl_link_id", "role_id") VALUES (now(), now(), '16', '3');
ALTER TABLE "users"
ADD "is_intro_video_skipped" boolean NOT NULL DEFAULT 'false';
COMMENT ON TABLE "users" IS '';
CREATE OR REPLACE VIEW users_listing AS
SELECT users.id,
users.role_id,
users.username,
users.password,
users.email,
users.full_name,
users.initials,
users.about_me,
users.profile_picture_path,
users.notification_frequency,
(users.is_allow_desktop_notification)::integer AS is_allow_desktop_notification,
(users.is_active)::integer AS is_active,
(users.is_email_confirmed)::integer AS is_email_confirmed,
users.created_organization_count,
users.created_board_count,
users.joined_organization_count,
users.list_count,
users.joined_card_count,
users.created_card_count,
users.joined_board_count,
users.checklist_count,
users.checklist_item_completed_count,
users.checklist_item_count,
users.activity_count,
users.card_voter_count,
(users.is_productivity_beats)::integer AS is_productivity_beats,
( SELECT array_to_json(array_agg(row_to_json(o.*))) AS array_to_json
FROM ( SELECT organizations_users_listing.organization_id AS id,
organizations_users_listing.name,
organizations_users_listing.description,
organizations_users_listing.website_url,
organizations_users_listing.logo_url,
organizations_users_listing.organization_visibility
FROM organizations_users_listing organizations_users_listing
WHERE (organizations_users_listing.user_id = users.id)
ORDER BY organizations_users_listing.id) o) AS organizations,
users.last_activity_id,
( SELECT array_to_json(array_agg(row_to_json(o.*))) AS array_to_json
FROM ( SELECT boards_stars.id,
boards_stars.board_id,
boards_stars.user_id,
(boards_stars.is_starred)::integer AS is_starred
FROM board_stars boards_stars
WHERE (boards_stars.user_id = users.id)
ORDER BY boards_stars.id) o) AS boards_stars,
( SELECT array_to_json(array_agg(row_to_json(o.*))) AS array_to_json
FROM ( SELECT boards_users.id,
boards_users.board_id,
boards_users.user_id,
boards_users.board_user_role_id,
boards.name,
boards.background_picture_url,
boards.background_pattern_url,
boards.background_color
FROM (boards_users boards_users
JOIN boards ON ((boards.id = boards_users.board_id)))
WHERE (boards_users.user_id = users.id)
ORDER BY boards_users.id) o) AS boards_users,
users.last_login_date,
li.ip AS last_login_ip,
lci.name AS login_city_name,
lst.name AS login_state_name,
lco.name AS login_country_name,
lower((lco.iso_alpha2)::text) AS login_country_iso2,
i.ip AS registered_ip,
rci.name AS register_city_name,
rst.name AS register_state_name,
rco.name AS register_country_name,
lower((rco.iso_alpha2)::text) AS register_country_iso2,
lt.name AS login_type,
to_char(users.created, 'YYYY-MM-DD"T"HH24:MI:SS'::text) AS created,
users.user_login_count,
users.is_send_newsletter,
users.last_email_notified_activity_id,
users.owner_board_count,
users.member_board_count,
users.owner_organization_count,
users.member_organization_count,
users.language,
(users.is_ldap)::integer AS is_ldap,
users.timezone,
users.default_desktop_notification,
users.is_list_notifications_enabled,
users.is_card_notifications_enabled,
users.is_card_members_notifications_enabled,
users.is_card_labels_notifications_enabled,
users.is_card_checklists_notifications_enabled,
users.is_card_attachments_notifications_enabled,
users.is_intro_video_skipped
FROM (((((((((users users
LEFT JOIN ips i ON ((i.id = users.ip_id)))
LEFT JOIN cities rci ON ((rci.id = i.city_id)))
LEFT JOIN states rst ON ((rst.id = i.state_id)))
LEFT JOIN countries rco ON ((rco.id = i.country_id)))
LEFT JOIN ips li ON ((li.id = users.last_login_ip_id)))
LEFT JOIN cities lci ON ((lci.id = li.city_id)))
LEFT JOIN states lst ON ((lst.id = li.state_id)))
LEFT JOIN countries lco ON ((lco.id = li.country_id)))
LEFT JOIN login_types lt ON ((lt.id = users.login_type_id)));