-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupdate_tables.sql
167 lines (121 loc) · 3.02 KB
/
update_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
160
161
162
163
164
165
166
167
ALTER TABLE framework_terminated_accounts
RENAME TO terminated_accounts;
ALTER TABLE terminated_accounts
ALTER COLUMN sessionticker
TYPE integer USING sessionticker::integer;
ALTER TABLE terminated_accounts
ALTER COLUMN sessionticker
SET DEFAULT 0;
ALTER TABLE terminated_accounts
ALTER COLUMN deleted_models
TYPE integer USING deleted_models::integer;
ALTER TABLE terminated_accounts
ALTER COLUMN deleted_models
SET DEFAULT 0;
ALTER TABLE terminated_accounts
ALTER COLUMN completedtests
TYPE integer USING completedtests::integer;
ALTER TABLE terminated_accounts
ALTER COLUMN completedtests
SET DEFAULT 0;
ALTER TABLE framework_case
RENAME TO mapscore_case;
ALTER TABLE framework_test_model_link
RENAME TO test_model_link;
ALTER TABLE framework_mainhits
RENAME TO mainhits;
ALTER TABLE mainhits
ALTER COLUMN hits
TYPE integer USING hits::integer;
ALTER TABLE mainhits
ALTER COLUMN hits
SET DEFAULT 0;
ALTER TABLE framework_model_account_link
RENAME TO model_account_link;
ALTER TABLE framework_account
RENAME TO account;
UPDATE account
SET photosizex = '0'
WHERE photosizex = '';
ALTER TABLE account
ALTER COLUMN photosizex
TYPE integer USING photosizex::integer;
ALTER TABLE account
ALTER COLUMN photosizex
SET DEFAULT 0;
UPDATE account
SET photosizey = '0'
WHERE photosizey = '';
ALTER TABLE account
ALTER COLUMN photosizey
TYPE integer USING photosizey::integer;
ALTER TABLE account
ALTER COLUMN photosizey
SET DEFAULT 0;
ALTER TABLE account
ALTER COLUMN sessionticker
TYPE integer USING sessionticker::integer;
ALTER TABLE account
ALTER COLUMN sessionticker
SET DEFAULT 0;
ALTER TABLE account
ALTER COLUMN completedtests
TYPE integer USING completedtests::integer;
ALTER TABLE account
ALTER COLUMN completedtests
SET DEFAULT 0;
ALTER TABLE account
ALTER COLUMN deleted_models
TYPE integer USING deleted_models::integer;
ALTER TABLE account
ALTER COLUMN deleted_models
SET DEFAULT 0;
ALTER TABLE account
ALTER COLUMN profpicrefresh
TYPE integer USING profpicrefresh::integer;
ALTER TABLE account
ALTER COLUMN profpicrefresh
SET DEFAULT 0;
ALTER TABLE framework_model
RENAME TO model;
ALTER TABLE model
RENAME "Completed_cases" TO completed_cases;
ALTER TABLE model
ALTER COLUMN completed_cases
TYPE integer USING completed_cases::integer;
ALTER TABLE model
ALTER COLUMN completed_cases
SET DEFAULT 0;
ALTER TABLE model
RENAME model_avgrating TO avgrating;
ALTER TABLE model
RENAME "model_nameID" TO name_id;
ALTER TABLE model
RENAME "Description" TO description;
ALTER TABLE model
ALTER COLUMN avgrating
SET DEFAULT 'unrated';
ALTER TABLE framework_test
RENAME TO test;
ALTER TABLE test
ALTER COLUMN grayrefresh
TYPE integer USING grayrefresh::integer;
ALTER TABLE test
ALTER COLUMN grayrefresh
SET DEFAULT 0;
ALTER TABLE test
ALTER COLUMN test_rating
SET DEFAULT 'unrated';
ALTER TABLE test
RENAME "Active" TO active;
ALTER TABLE test
ALTER COLUMN active
SET DEFAULT TRUE;
ALTER TABLE test
ALTER COLUMN nav
SET DEFAULT '0';
ALTER TABLE test
ALTER COLUMN show_instructions
SET DEFAULT TRUE;
ALTER TABLE framework_case
RENAME TO mapscore_case;