liquid_feedback_core
changeset 191:44e489d77306
Renamed demo.sql to test.sql
author | jbe |
---|---|
date | Sun Sep 04 16:39:13 2011 +0200 (2011-09-04) |
parents | 9d811ba751c6 |
children | a5fed9a4154e |
files | demo.sql test.sql |
line diff
1.1 --- a/demo.sql Sat Jul 30 15:18:45 2011 +0200 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,470 +0,0 @@ 1.4 --- NOTE: This file requires that sequence generators have not been used. 1.5 --- (All new rows need to start with id '1'.) 1.6 - 1.7 -BEGIN; 1.8 - 1.9 -INSERT INTO "member" ("activated", "last_activity", "active", "login", "name") VALUES 1.10 - ('now', 'now', TRUE, 'user1', 'User #1'), -- id 1 1.11 - ('now', 'now', TRUE, 'user2', 'User #2'), -- id 2 1.12 - ('now', 'now', TRUE, 'user3', 'User #3'), -- id 3 1.13 - ('now', 'now', TRUE, 'user4', 'User #4'), -- id 4 1.14 - ('now', 'now', TRUE, 'user5', 'User #5'), -- id 5 1.15 - ('now', 'now', TRUE, 'user6', 'User #6'), -- id 6 1.16 - ('now', 'now', TRUE, 'user7', 'User #7'), -- id 7 1.17 - ('now', 'now', TRUE, 'user8', 'User #8'), -- id 8 1.18 - ('now', 'now', TRUE, 'user9', 'User #9'), -- id 9 1.19 - ('now', 'now', TRUE, 'user10', 'User #10'), -- id 10 1.20 - ('now', 'now', TRUE, 'user11', 'User #11'), -- id 11 1.21 - ('now', 'now', TRUE, 'user12', 'User #12'), -- id 12 1.22 - ('now', 'now', TRUE, 'user13', 'User #13'), -- id 13 1.23 - ('now', 'now', TRUE, 'user14', 'User #14'), -- id 14 1.24 - ('now', 'now', TRUE, 'user15', 'User #15'), -- id 15 1.25 - ('now', 'now', TRUE, 'user16', 'User #16'), -- id 16 1.26 - ('now', 'now', TRUE, 'user17', 'User #17'), -- id 17 1.27 - ('now', 'now', TRUE, 'user18', 'User #18'), -- id 18 1.28 - ('now', 'now', TRUE, 'user19', 'User #19'), -- id 19 1.29 - ('now', 'now', TRUE, 'user20', 'User #20'), -- id 20 1.30 - ('now', 'now', TRUE, 'user21', 'User #21'), -- id 21 1.31 - ('now', 'now', TRUE, 'user22', 'User #22'), -- id 22 1.32 - ('now', 'now', TRUE, 'user23', 'User #23'); -- id 23 1.33 - 1.34 --- set password to "login" 1.35 -UPDATE "member" SET "password" = '$1$PcI6b1Bg$2SHjAZH2nMLFp0fxHis.Q0'; 1.36 - 1.37 -INSERT INTO "policy" ( 1.38 - "index", 1.39 - "name", 1.40 - "admission_time", 1.41 - "discussion_time", 1.42 - "verification_time", 1.43 - "voting_time", 1.44 - "issue_quorum_num", "issue_quorum_den", 1.45 - "initiative_quorum_num", "initiative_quorum_den", 1.46 - "direct_majority_num", "direct_majority_den", "direct_majority_strict", 1.47 - "no_reverse_beat_path", "no_multistage_majority" 1.48 - ) VALUES ( 1.49 - 1, 1.50 - 'Default policy', 1.51 - '1 hour', '1 hour', '1 hour', '1 hour', 1.52 - 25, 100, 1.53 - 20, 100, 1.54 - 1, 2, TRUE, 1.55 - TRUE, FALSE ); 1.56 - 1.57 -CREATE FUNCTION "time_warp"() RETURNS VOID 1.58 - LANGUAGE 'plpgsql' VOLATILE AS $$ 1.59 - BEGIN 1.60 - UPDATE "issue" SET 1.61 - "snapshot" = "snapshot" - '1 hour 1 minute'::INTERVAL, 1.62 - "created" = "created" - '1 hour 1 minute'::INTERVAL, 1.63 - "accepted" = "accepted" - '1 hour 1 minute'::INTERVAL, 1.64 - "half_frozen" = "half_frozen" - '1 hour 1 minute'::INTERVAL, 1.65 - "fully_frozen" = "fully_frozen" - '1 hour 1 minute'::INTERVAL; 1.66 - PERFORM "check_everything"(); 1.67 - RETURN; 1.68 - END; 1.69 - $$; 1.70 - 1.71 -INSERT INTO "unit" ("name") VALUES ('Main'); 1.72 - 1.73 -INSERT INTO "privilege" ("unit_id", "member_id", "voting_right") 1.74 - SELECT 1 AS "unit_id", "id" AS "member_id", TRUE AS "voting_right" 1.75 - FROM "member"; 1.76 - 1.77 -INSERT INTO "area" ("unit_id", "name") VALUES 1.78 - (1, 'Area #1'), -- id 1 1.79 - (1, 'Area #2'), -- id 2 1.80 - (1, 'Area #3'), -- id 3 1.81 - (1, 'Area #4'); -- id 4 1.82 - 1.83 -INSERT INTO "allowed_policy" ("area_id", "policy_id", "default_policy") 1.84 - VALUES (1, 1, TRUE), (2, 1, TRUE), (3, 1, TRUE), (4, 1, TRUE); 1.85 - 1.86 -INSERT INTO "membership" ("area_id", "member_id") VALUES 1.87 - (1, 9), 1.88 - (1, 19), 1.89 - (2, 9), 1.90 - (2, 10), 1.91 - (2, 17), 1.92 - (3, 9), 1.93 - (3, 11), 1.94 - (3, 12), 1.95 - (3, 14), 1.96 - (3, 20), 1.97 - (3, 21), 1.98 - (3, 22), 1.99 - (4, 6), 1.100 - (4, 9), 1.101 - (4, 13), 1.102 - (4, 22); 1.103 - 1.104 --- global delegations 1.105 -INSERT INTO "delegation" 1.106 - ("truster_id", "scope", "unit_id", "trustee_id") VALUES 1.107 - ( 1, 'unit', 1, 9), 1.108 - ( 2, 'unit', 1, 11), 1.109 - ( 3, 'unit', 1, 12), 1.110 - ( 4, 'unit', 1, 13), 1.111 - ( 5, 'unit', 1, 14), 1.112 - ( 6, 'unit', 1, 7), 1.113 - ( 7, 'unit', 1, 8), 1.114 - ( 8, 'unit', 1, 6), 1.115 - (10, 'unit', 1, 9), 1.116 - (11, 'unit', 1, 9), 1.117 - (12, 'unit', 1, 21), 1.118 - (15, 'unit', 1, 10), 1.119 - (16, 'unit', 1, 17), 1.120 - (17, 'unit', 1, 19), 1.121 - (18, 'unit', 1, 19), 1.122 - (23, 'unit', 1, 22); 1.123 - 1.124 --- delegations for topics 1.125 -INSERT INTO "delegation" 1.126 - ("area_id", "truster_id", "scope", "trustee_id") VALUES 1.127 - (1, 3, 'area', 17), 1.128 - (2, 5, 'area', 10), 1.129 - (2, 9, 'area', 10), 1.130 - (3, 4, 'area', 14), 1.131 - (3, 16, 'area', 20), 1.132 - (3, 19, 'area', 20), 1.133 - (4, 5, 'area', 13), 1.134 - (4, 12, 'area', 22); 1.135 - 1.136 -INSERT INTO "issue" ("area_id", "policy_id") VALUES 1.137 - (3, 1); -- id 1 1.138 - 1.139 -INSERT INTO "initiative" ("issue_id", "name") VALUES 1.140 - (1, 'Initiative #1'), -- id 1 1.141 - (1, 'Initiative #2'), -- id 2 1.142 - (1, 'Initiative #3'), -- id 3 1.143 - (1, 'Initiative #4'), -- id 4 1.144 - (1, 'Initiative #5'), -- id 5 1.145 - (1, 'Initiative #6'), -- id 6 1.146 - (1, 'Initiative #7'); -- id 7 1.147 - 1.148 -INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES 1.149 - (1, 17, 'Lorem ipsum...'), -- id 1 1.150 - (2, 20, 'Lorem ipsum...'), -- id 2 1.151 - (3, 20, 'Lorem ipsum...'), -- id 3 1.152 - (4, 20, 'Lorem ipsum...'), -- id 4 1.153 - (5, 14, 'Lorem ipsum...'), -- id 5 1.154 - (6, 11, 'Lorem ipsum...'), -- id 6 1.155 - (7, 12, 'Lorem ipsum...'); -- id 7 1.156 - 1.157 -INSERT INTO "initiator" ("initiative_id", "member_id") VALUES 1.158 - (1, 17), 1.159 - (1, 19), 1.160 - (2, 20), 1.161 - (3, 20), 1.162 - (4, 20), 1.163 - (5, 14), 1.164 - (6, 11), 1.165 - (7, 12); 1.166 - 1.167 -INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES 1.168 - ( 7, 4, 4), 1.169 - ( 8, 2, 2), 1.170 - (11, 6, 6), 1.171 - (12, 7, 7), 1.172 - (14, 1, 1), 1.173 - (14, 2, 2), 1.174 - (14, 3, 3), 1.175 - (14, 4, 4), 1.176 - (14, 5, 5), 1.177 - (14, 6, 6), 1.178 - (14, 7, 7), 1.179 - (17, 1, 1), 1.180 - (17, 3, 3), 1.181 - (19, 1, 1), 1.182 - (19, 2, 2), 1.183 - (20, 1, 1), 1.184 - (20, 2, 2), 1.185 - (20, 3, 3), 1.186 - (20, 4, 4), 1.187 - (20, 5, 5); 1.188 - 1.189 -INSERT INTO "suggestion" ("initiative_id", "author_id", "name", "content") VALUES 1.190 - (1, 19, 'Suggestion #1', 'Lorem ipsum...'); -- id 1 1.191 -INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES 1.192 - (14, 1, 2, FALSE); 1.193 -INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES 1.194 - (19, 1, 2, FALSE); 1.195 - 1.196 -INSERT INTO "issue" ("area_id", "policy_id") VALUES 1.197 - (4, 1); -- id 2 1.198 - 1.199 -INSERT INTO "initiative" ("issue_id", "name") VALUES 1.200 - (2, 'Initiative A'), -- id 8 1.201 - (2, 'Initiative B'), -- id 9 1.202 - (2, 'Initiative C'), -- id 10 1.203 - (2, 'Initiative D'); -- id 11 1.204 - 1.205 -INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES 1.206 - ( 8, 1, 'Lorem ipsum...'), -- id 8 1.207 - ( 9, 2, 'Lorem ipsum...'), -- id 9 1.208 - (10, 3, 'Lorem ipsum...'), -- id 10 1.209 - (11, 4, 'Lorem ipsum...'); -- id 11 1.210 - 1.211 -INSERT INTO "initiator" ("initiative_id", "member_id") VALUES 1.212 - ( 8, 1), 1.213 - ( 9, 2), 1.214 - (10, 3), 1.215 - (11, 4); 1.216 - 1.217 -INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES 1.218 - (1, 8, 8), 1.219 - (1, 9, 9), 1.220 - (1, 10, 10), 1.221 - (1, 11, 11), 1.222 - (2, 8, 8), 1.223 - (2, 9, 9), 1.224 - (2, 10, 10), 1.225 - (2, 11, 11), 1.226 - (3, 8, 8), 1.227 - (3, 9, 9), 1.228 - (3, 10, 10), 1.229 - (3, 11, 11), 1.230 - (4, 8, 8), 1.231 - (4, 9, 9), 1.232 - (4, 10, 10), 1.233 - (4, 11, 11), 1.234 - (5, 8, 8), 1.235 - (5, 9, 9), 1.236 - (5, 10, 10), 1.237 - (5, 11, 11), 1.238 - (6, 8, 8), 1.239 - (6, 9, 9), 1.240 - (6, 10, 10), 1.241 - (6, 11, 11); 1.242 - 1.243 -SELECT "time_warp"(); 1.244 -SELECT "time_warp"(); 1.245 -SELECT "time_warp"(); 1.246 - 1.247 -INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES 1.248 - ( 8, 1), 1.249 - ( 9, 1), 1.250 - (11, 1), 1.251 - (12, 1), 1.252 - (14, 1), 1.253 - (19, 1), 1.254 - (20, 1), 1.255 - (21, 1); 1.256 - 1.257 -INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES 1.258 - ( 8, 1, 1, 1), 1.259 - ( 8, 1, 2, 1), 1.260 - ( 8, 1, 3, 1), 1.261 - ( 8, 1, 4, 1), 1.262 - ( 8, 1, 5, 1), 1.263 - ( 8, 1, 6, -1), 1.264 - ( 8, 1, 7, -1), 1.265 - ( 9, 1, 1, -2), 1.266 - ( 9, 1, 2, -3), 1.267 - ( 9, 1, 3, -2), 1.268 - ( 9, 1, 4, -2), 1.269 - ( 9, 1, 5, -2), 1.270 - ( 9, 1, 6, -1), 1.271 - (11, 1, 1, -1), 1.272 - (11, 1, 2, -1), 1.273 - (11, 1, 3, -1), 1.274 - (11, 1, 4, -1), 1.275 - (11, 1, 5, -1), 1.276 - (11, 1, 6, 2), 1.277 - (11, 1, 7, 1), 1.278 - (12, 1, 1, -1), 1.279 - (12, 1, 3, -1), 1.280 - (12, 1, 4, -1), 1.281 - (12, 1, 5, -1), 1.282 - (12, 1, 6, -2), 1.283 - (12, 1, 7, 1), 1.284 - (14, 1, 1, 1), 1.285 - (14, 1, 2, 3), 1.286 - (14, 1, 3, 1), 1.287 - (14, 1, 4, 2), 1.288 - (14, 1, 5, 1), 1.289 - (14, 1, 6, 1), 1.290 - (14, 1, 7, 1), 1.291 - (19, 1, 1, 3), 1.292 - (19, 1, 2, 4), 1.293 - (19, 1, 3, 2), 1.294 - (19, 1, 4, 2), 1.295 - (19, 1, 5, 2), 1.296 - (19, 1, 7, 1), 1.297 - (20, 1, 1, 1), 1.298 - (20, 1, 2, 2), 1.299 - (20, 1, 3, 1), 1.300 - (20, 1, 4, 1), 1.301 - (20, 1, 5, 1), 1.302 - (21, 1, 5, -1); 1.303 - 1.304 -INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES 1.305 - ( 1, 2), 1.306 - ( 2, 2), 1.307 - ( 3, 2), 1.308 - ( 4, 2), 1.309 - ( 5, 2), 1.310 - ( 6, 2), 1.311 - ( 7, 2), 1.312 - ( 8, 2), 1.313 - ( 9, 2), 1.314 - (10, 2), 1.315 - (11, 2), 1.316 - (12, 2), 1.317 - (13, 2), 1.318 - (14, 2), 1.319 - (15, 2), 1.320 - (16, 2), 1.321 - (17, 2), 1.322 - (18, 2), 1.323 - (19, 2), 1.324 - (20, 2); 1.325 - 1.326 -INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES 1.327 - ( 1, 2, 8, 3), 1.328 - ( 1, 2, 9, 4), 1.329 - ( 1, 2, 10, 2), 1.330 - ( 1, 2, 11, 1), 1.331 - ( 2, 2, 8, 3), 1.332 - ( 2, 2, 9, 4), 1.333 - ( 2, 2, 10, 2), 1.334 - ( 2, 2, 11, 1), 1.335 - ( 3, 2, 8, 4), 1.336 - ( 3, 2, 9, 3), 1.337 - ( 3, 2, 10, 2), 1.338 - ( 3, 2, 11, 1), 1.339 - ( 4, 2, 8, 4), 1.340 - ( 4, 2, 9, 3), 1.341 - ( 4, 2, 10, 2), 1.342 - ( 4, 2, 11, 1), 1.343 - ( 5, 2, 8, 4), 1.344 - ( 5, 2, 9, 3), 1.345 - ( 5, 2, 10, 2), 1.346 - ( 5, 2, 11, 1), 1.347 - ( 6, 2, 8, 4), 1.348 - ( 6, 2, 9, 3), 1.349 - ( 6, 2, 10, 2), 1.350 - ( 6, 2, 11, 1), 1.351 - ( 7, 2, 8, 4), 1.352 - ( 7, 2, 9, 3), 1.353 - ( 7, 2, 10, 2), 1.354 - ( 7, 2, 11, 1), 1.355 - ( 8, 2, 8, 4), 1.356 - ( 8, 2, 9, 3), 1.357 - ( 8, 2, 10, 2), 1.358 - ( 8, 2, 11, 1), 1.359 - ( 9, 2, 8, -1), 1.360 - ( 9, 2, 9, 1), 1.361 - ( 9, 2, 10, 3), 1.362 - ( 9, 2, 11, 2), 1.363 - (10, 2, 8, -1), 1.364 - (10, 2, 9, 1), 1.365 - (10, 2, 10, 3), 1.366 - (10, 2, 11, 2), 1.367 - (11, 2, 8, -1), 1.368 - (11, 2, 9, 1), 1.369 - (11, 2, 10, 3), 1.370 - (11, 2, 11, 2), 1.371 - (12, 2, 8, -1), 1.372 - (12, 2, 9, 1), 1.373 - (12, 2, 10, 3), 1.374 - (12, 2, 11, 2), 1.375 - (13, 2, 8, -1), 1.376 - (13, 2, 9, 1), 1.377 - (13, 2, 10, 3), 1.378 - (13, 2, 11, 2), 1.379 - (14, 2, 8, -1), 1.380 - (14, 2, 9, 1), 1.381 - (14, 2, 10, 3), 1.382 - (14, 2, 11, 2), 1.383 - (15, 2, 8, -1), 1.384 - (15, 2, 9, -3), 1.385 - (15, 2, 10, -4), 1.386 - (15, 2, 11, -2), 1.387 - (16, 2, 8, -1), 1.388 - (16, 2, 9, -3), 1.389 - (16, 2, 10, -4), 1.390 - (16, 2, 11, -2), 1.391 - (17, 2, 8, -1), 1.392 - (17, 2, 9, -3), 1.393 - (17, 2, 10, -4), 1.394 - (17, 2, 11, -2), 1.395 - (18, 2, 8, -1), 1.396 - (18, 2, 9, 1), 1.397 - (18, 2, 10, -2), 1.398 - (18, 2, 11, 2), 1.399 - (19, 2, 8, -1), 1.400 - (19, 2, 9, 1), 1.401 - (19, 2, 10, -2), 1.402 - (19, 2, 11, 2), 1.403 - (20, 2, 8, 1), 1.404 - (20, 2, 9, 2), 1.405 - (20, 2, 10, -1), 1.406 - (20, 2, 11, 3); 1.407 - 1.408 -SELECT "time_warp"(); 1.409 - 1.410 -DROP FUNCTION "time_warp"(); 1.411 - 1.412 --- Test policies that help with testing specific frontend parts 1.413 - 1.414 -INSERT INTO "policy" ( 1.415 - "index", 1.416 - "active", 1.417 - "name", 1.418 - "description", 1.419 - "admission_time", 1.420 - "discussion_time", 1.421 - "verification_time", 1.422 - "voting_time", 1.423 - "issue_quorum_num", 1.424 - "issue_quorum_den", 1.425 - "initiative_quorum_num", 1.426 - "initiative_quorum_den" 1.427 - ) VALUES ( 1.428 - 1, 1.429 - TRUE, 1.430 - 'Test New', 1.431 - DEFAULT, 1.432 - '2 days', 1.433 - '1 second', 1.434 - '1 second', 1.435 - '1 second', 1.436 - 0, 100, 1.437 - 0, 100 1.438 - ), ( 1.439 - 1, 1.440 - TRUE, 1.441 - 'Test Accept', 1.442 - DEFAULT, 1.443 - '1 second', 1.444 - '2 days', 1.445 - '1 second', 1.446 - '1 second', 1.447 - 0, 100, 1.448 - 0, 100 1.449 - ), ( 1.450 - 1, 1.451 - TRUE, 1.452 - 'Test Frozen', 1.453 - DEFAULT, 1.454 - '1 second', 1.455 - '5 minutes', 1.456 - '2 days', 1.457 - '1 second', 1.458 - 0, 100, 1.459 - 0, 100 1.460 - ), ( 1.461 - 1, 1.462 - TRUE, 1.463 - 'Test Voting', 1.464 - DEFAULT, 1.465 - '1 second', 1.466 - '5 minutes', 1.467 - '1 second', 1.468 - '2 days', 1.469 - 0, 100, 1.470 - 0, 100 1.471 - ); 1.472 -END; 1.473 -
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test.sql Sun Sep 04 16:39:13 2011 +0200 2.3 @@ -0,0 +1,470 @@ 2.4 +-- NOTE: This file requires that sequence generators have not been used. 2.5 +-- (All new rows need to start with id '1'.) 2.6 + 2.7 +BEGIN; 2.8 + 2.9 +INSERT INTO "member" ("activated", "last_activity", "active", "login", "name") VALUES 2.10 + ('now', 'now', TRUE, 'user1', 'User #1'), -- id 1 2.11 + ('now', 'now', TRUE, 'user2', 'User #2'), -- id 2 2.12 + ('now', 'now', TRUE, 'user3', 'User #3'), -- id 3 2.13 + ('now', 'now', TRUE, 'user4', 'User #4'), -- id 4 2.14 + ('now', 'now', TRUE, 'user5', 'User #5'), -- id 5 2.15 + ('now', 'now', TRUE, 'user6', 'User #6'), -- id 6 2.16 + ('now', 'now', TRUE, 'user7', 'User #7'), -- id 7 2.17 + ('now', 'now', TRUE, 'user8', 'User #8'), -- id 8 2.18 + ('now', 'now', TRUE, 'user9', 'User #9'), -- id 9 2.19 + ('now', 'now', TRUE, 'user10', 'User #10'), -- id 10 2.20 + ('now', 'now', TRUE, 'user11', 'User #11'), -- id 11 2.21 + ('now', 'now', TRUE, 'user12', 'User #12'), -- id 12 2.22 + ('now', 'now', TRUE, 'user13', 'User #13'), -- id 13 2.23 + ('now', 'now', TRUE, 'user14', 'User #14'), -- id 14 2.24 + ('now', 'now', TRUE, 'user15', 'User #15'), -- id 15 2.25 + ('now', 'now', TRUE, 'user16', 'User #16'), -- id 16 2.26 + ('now', 'now', TRUE, 'user17', 'User #17'), -- id 17 2.27 + ('now', 'now', TRUE, 'user18', 'User #18'), -- id 18 2.28 + ('now', 'now', TRUE, 'user19', 'User #19'), -- id 19 2.29 + ('now', 'now', TRUE, 'user20', 'User #20'), -- id 20 2.30 + ('now', 'now', TRUE, 'user21', 'User #21'), -- id 21 2.31 + ('now', 'now', TRUE, 'user22', 'User #22'), -- id 22 2.32 + ('now', 'now', TRUE, 'user23', 'User #23'); -- id 23 2.33 + 2.34 +-- set password to "login" 2.35 +UPDATE "member" SET "password" = '$1$PcI6b1Bg$2SHjAZH2nMLFp0fxHis.Q0'; 2.36 + 2.37 +INSERT INTO "policy" ( 2.38 + "index", 2.39 + "name", 2.40 + "admission_time", 2.41 + "discussion_time", 2.42 + "verification_time", 2.43 + "voting_time", 2.44 + "issue_quorum_num", "issue_quorum_den", 2.45 + "initiative_quorum_num", "initiative_quorum_den", 2.46 + "direct_majority_num", "direct_majority_den", "direct_majority_strict", 2.47 + "no_reverse_beat_path", "no_multistage_majority" 2.48 + ) VALUES ( 2.49 + 1, 2.50 + 'Default policy', 2.51 + '1 hour', '1 hour', '1 hour', '1 hour', 2.52 + 25, 100, 2.53 + 20, 100, 2.54 + 1, 2, TRUE, 2.55 + TRUE, FALSE ); 2.56 + 2.57 +CREATE FUNCTION "time_warp"() RETURNS VOID 2.58 + LANGUAGE 'plpgsql' VOLATILE AS $$ 2.59 + BEGIN 2.60 + UPDATE "issue" SET 2.61 + "snapshot" = "snapshot" - '1 hour 1 minute'::INTERVAL, 2.62 + "created" = "created" - '1 hour 1 minute'::INTERVAL, 2.63 + "accepted" = "accepted" - '1 hour 1 minute'::INTERVAL, 2.64 + "half_frozen" = "half_frozen" - '1 hour 1 minute'::INTERVAL, 2.65 + "fully_frozen" = "fully_frozen" - '1 hour 1 minute'::INTERVAL; 2.66 + PERFORM "check_everything"(); 2.67 + RETURN; 2.68 + END; 2.69 + $$; 2.70 + 2.71 +INSERT INTO "unit" ("name") VALUES ('Main'); 2.72 + 2.73 +INSERT INTO "privilege" ("unit_id", "member_id", "voting_right") 2.74 + SELECT 1 AS "unit_id", "id" AS "member_id", TRUE AS "voting_right" 2.75 + FROM "member"; 2.76 + 2.77 +INSERT INTO "area" ("unit_id", "name") VALUES 2.78 + (1, 'Area #1'), -- id 1 2.79 + (1, 'Area #2'), -- id 2 2.80 + (1, 'Area #3'), -- id 3 2.81 + (1, 'Area #4'); -- id 4 2.82 + 2.83 +INSERT INTO "allowed_policy" ("area_id", "policy_id", "default_policy") 2.84 + VALUES (1, 1, TRUE), (2, 1, TRUE), (3, 1, TRUE), (4, 1, TRUE); 2.85 + 2.86 +INSERT INTO "membership" ("area_id", "member_id") VALUES 2.87 + (1, 9), 2.88 + (1, 19), 2.89 + (2, 9), 2.90 + (2, 10), 2.91 + (2, 17), 2.92 + (3, 9), 2.93 + (3, 11), 2.94 + (3, 12), 2.95 + (3, 14), 2.96 + (3, 20), 2.97 + (3, 21), 2.98 + (3, 22), 2.99 + (4, 6), 2.100 + (4, 9), 2.101 + (4, 13), 2.102 + (4, 22); 2.103 + 2.104 +-- global delegations 2.105 +INSERT INTO "delegation" 2.106 + ("truster_id", "scope", "unit_id", "trustee_id") VALUES 2.107 + ( 1, 'unit', 1, 9), 2.108 + ( 2, 'unit', 1, 11), 2.109 + ( 3, 'unit', 1, 12), 2.110 + ( 4, 'unit', 1, 13), 2.111 + ( 5, 'unit', 1, 14), 2.112 + ( 6, 'unit', 1, 7), 2.113 + ( 7, 'unit', 1, 8), 2.114 + ( 8, 'unit', 1, 6), 2.115 + (10, 'unit', 1, 9), 2.116 + (11, 'unit', 1, 9), 2.117 + (12, 'unit', 1, 21), 2.118 + (15, 'unit', 1, 10), 2.119 + (16, 'unit', 1, 17), 2.120 + (17, 'unit', 1, 19), 2.121 + (18, 'unit', 1, 19), 2.122 + (23, 'unit', 1, 22); 2.123 + 2.124 +-- delegations for topics 2.125 +INSERT INTO "delegation" 2.126 + ("area_id", "truster_id", "scope", "trustee_id") VALUES 2.127 + (1, 3, 'area', 17), 2.128 + (2, 5, 'area', 10), 2.129 + (2, 9, 'area', 10), 2.130 + (3, 4, 'area', 14), 2.131 + (3, 16, 'area', 20), 2.132 + (3, 19, 'area', 20), 2.133 + (4, 5, 'area', 13), 2.134 + (4, 12, 'area', 22); 2.135 + 2.136 +INSERT INTO "issue" ("area_id", "policy_id") VALUES 2.137 + (3, 1); -- id 1 2.138 + 2.139 +INSERT INTO "initiative" ("issue_id", "name") VALUES 2.140 + (1, 'Initiative #1'), -- id 1 2.141 + (1, 'Initiative #2'), -- id 2 2.142 + (1, 'Initiative #3'), -- id 3 2.143 + (1, 'Initiative #4'), -- id 4 2.144 + (1, 'Initiative #5'), -- id 5 2.145 + (1, 'Initiative #6'), -- id 6 2.146 + (1, 'Initiative #7'); -- id 7 2.147 + 2.148 +INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES 2.149 + (1, 17, 'Lorem ipsum...'), -- id 1 2.150 + (2, 20, 'Lorem ipsum...'), -- id 2 2.151 + (3, 20, 'Lorem ipsum...'), -- id 3 2.152 + (4, 20, 'Lorem ipsum...'), -- id 4 2.153 + (5, 14, 'Lorem ipsum...'), -- id 5 2.154 + (6, 11, 'Lorem ipsum...'), -- id 6 2.155 + (7, 12, 'Lorem ipsum...'); -- id 7 2.156 + 2.157 +INSERT INTO "initiator" ("initiative_id", "member_id") VALUES 2.158 + (1, 17), 2.159 + (1, 19), 2.160 + (2, 20), 2.161 + (3, 20), 2.162 + (4, 20), 2.163 + (5, 14), 2.164 + (6, 11), 2.165 + (7, 12); 2.166 + 2.167 +INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES 2.168 + ( 7, 4, 4), 2.169 + ( 8, 2, 2), 2.170 + (11, 6, 6), 2.171 + (12, 7, 7), 2.172 + (14, 1, 1), 2.173 + (14, 2, 2), 2.174 + (14, 3, 3), 2.175 + (14, 4, 4), 2.176 + (14, 5, 5), 2.177 + (14, 6, 6), 2.178 + (14, 7, 7), 2.179 + (17, 1, 1), 2.180 + (17, 3, 3), 2.181 + (19, 1, 1), 2.182 + (19, 2, 2), 2.183 + (20, 1, 1), 2.184 + (20, 2, 2), 2.185 + (20, 3, 3), 2.186 + (20, 4, 4), 2.187 + (20, 5, 5); 2.188 + 2.189 +INSERT INTO "suggestion" ("initiative_id", "author_id", "name", "content") VALUES 2.190 + (1, 19, 'Suggestion #1', 'Lorem ipsum...'); -- id 1 2.191 +INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES 2.192 + (14, 1, 2, FALSE); 2.193 +INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES 2.194 + (19, 1, 2, FALSE); 2.195 + 2.196 +INSERT INTO "issue" ("area_id", "policy_id") VALUES 2.197 + (4, 1); -- id 2 2.198 + 2.199 +INSERT INTO "initiative" ("issue_id", "name") VALUES 2.200 + (2, 'Initiative A'), -- id 8 2.201 + (2, 'Initiative B'), -- id 9 2.202 + (2, 'Initiative C'), -- id 10 2.203 + (2, 'Initiative D'); -- id 11 2.204 + 2.205 +INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES 2.206 + ( 8, 1, 'Lorem ipsum...'), -- id 8 2.207 + ( 9, 2, 'Lorem ipsum...'), -- id 9 2.208 + (10, 3, 'Lorem ipsum...'), -- id 10 2.209 + (11, 4, 'Lorem ipsum...'); -- id 11 2.210 + 2.211 +INSERT INTO "initiator" ("initiative_id", "member_id") VALUES 2.212 + ( 8, 1), 2.213 + ( 9, 2), 2.214 + (10, 3), 2.215 + (11, 4); 2.216 + 2.217 +INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES 2.218 + (1, 8, 8), 2.219 + (1, 9, 9), 2.220 + (1, 10, 10), 2.221 + (1, 11, 11), 2.222 + (2, 8, 8), 2.223 + (2, 9, 9), 2.224 + (2, 10, 10), 2.225 + (2, 11, 11), 2.226 + (3, 8, 8), 2.227 + (3, 9, 9), 2.228 + (3, 10, 10), 2.229 + (3, 11, 11), 2.230 + (4, 8, 8), 2.231 + (4, 9, 9), 2.232 + (4, 10, 10), 2.233 + (4, 11, 11), 2.234 + (5, 8, 8), 2.235 + (5, 9, 9), 2.236 + (5, 10, 10), 2.237 + (5, 11, 11), 2.238 + (6, 8, 8), 2.239 + (6, 9, 9), 2.240 + (6, 10, 10), 2.241 + (6, 11, 11); 2.242 + 2.243 +SELECT "time_warp"(); 2.244 +SELECT "time_warp"(); 2.245 +SELECT "time_warp"(); 2.246 + 2.247 +INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES 2.248 + ( 8, 1), 2.249 + ( 9, 1), 2.250 + (11, 1), 2.251 + (12, 1), 2.252 + (14, 1), 2.253 + (19, 1), 2.254 + (20, 1), 2.255 + (21, 1); 2.256 + 2.257 +INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES 2.258 + ( 8, 1, 1, 1), 2.259 + ( 8, 1, 2, 1), 2.260 + ( 8, 1, 3, 1), 2.261 + ( 8, 1, 4, 1), 2.262 + ( 8, 1, 5, 1), 2.263 + ( 8, 1, 6, -1), 2.264 + ( 8, 1, 7, -1), 2.265 + ( 9, 1, 1, -2), 2.266 + ( 9, 1, 2, -3), 2.267 + ( 9, 1, 3, -2), 2.268 + ( 9, 1, 4, -2), 2.269 + ( 9, 1, 5, -2), 2.270 + ( 9, 1, 6, -1), 2.271 + (11, 1, 1, -1), 2.272 + (11, 1, 2, -1), 2.273 + (11, 1, 3, -1), 2.274 + (11, 1, 4, -1), 2.275 + (11, 1, 5, -1), 2.276 + (11, 1, 6, 2), 2.277 + (11, 1, 7, 1), 2.278 + (12, 1, 1, -1), 2.279 + (12, 1, 3, -1), 2.280 + (12, 1, 4, -1), 2.281 + (12, 1, 5, -1), 2.282 + (12, 1, 6, -2), 2.283 + (12, 1, 7, 1), 2.284 + (14, 1, 1, 1), 2.285 + (14, 1, 2, 3), 2.286 + (14, 1, 3, 1), 2.287 + (14, 1, 4, 2), 2.288 + (14, 1, 5, 1), 2.289 + (14, 1, 6, 1), 2.290 + (14, 1, 7, 1), 2.291 + (19, 1, 1, 3), 2.292 + (19, 1, 2, 4), 2.293 + (19, 1, 3, 2), 2.294 + (19, 1, 4, 2), 2.295 + (19, 1, 5, 2), 2.296 + (19, 1, 7, 1), 2.297 + (20, 1, 1, 1), 2.298 + (20, 1, 2, 2), 2.299 + (20, 1, 3, 1), 2.300 + (20, 1, 4, 1), 2.301 + (20, 1, 5, 1), 2.302 + (21, 1, 5, -1); 2.303 + 2.304 +INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES 2.305 + ( 1, 2), 2.306 + ( 2, 2), 2.307 + ( 3, 2), 2.308 + ( 4, 2), 2.309 + ( 5, 2), 2.310 + ( 6, 2), 2.311 + ( 7, 2), 2.312 + ( 8, 2), 2.313 + ( 9, 2), 2.314 + (10, 2), 2.315 + (11, 2), 2.316 + (12, 2), 2.317 + (13, 2), 2.318 + (14, 2), 2.319 + (15, 2), 2.320 + (16, 2), 2.321 + (17, 2), 2.322 + (18, 2), 2.323 + (19, 2), 2.324 + (20, 2); 2.325 + 2.326 +INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES 2.327 + ( 1, 2, 8, 3), 2.328 + ( 1, 2, 9, 4), 2.329 + ( 1, 2, 10, 2), 2.330 + ( 1, 2, 11, 1), 2.331 + ( 2, 2, 8, 3), 2.332 + ( 2, 2, 9, 4), 2.333 + ( 2, 2, 10, 2), 2.334 + ( 2, 2, 11, 1), 2.335 + ( 3, 2, 8, 4), 2.336 + ( 3, 2, 9, 3), 2.337 + ( 3, 2, 10, 2), 2.338 + ( 3, 2, 11, 1), 2.339 + ( 4, 2, 8, 4), 2.340 + ( 4, 2, 9, 3), 2.341 + ( 4, 2, 10, 2), 2.342 + ( 4, 2, 11, 1), 2.343 + ( 5, 2, 8, 4), 2.344 + ( 5, 2, 9, 3), 2.345 + ( 5, 2, 10, 2), 2.346 + ( 5, 2, 11, 1), 2.347 + ( 6, 2, 8, 4), 2.348 + ( 6, 2, 9, 3), 2.349 + ( 6, 2, 10, 2), 2.350 + ( 6, 2, 11, 1), 2.351 + ( 7, 2, 8, 4), 2.352 + ( 7, 2, 9, 3), 2.353 + ( 7, 2, 10, 2), 2.354 + ( 7, 2, 11, 1), 2.355 + ( 8, 2, 8, 4), 2.356 + ( 8, 2, 9, 3), 2.357 + ( 8, 2, 10, 2), 2.358 + ( 8, 2, 11, 1), 2.359 + ( 9, 2, 8, -1), 2.360 + ( 9, 2, 9, 1), 2.361 + ( 9, 2, 10, 3), 2.362 + ( 9, 2, 11, 2), 2.363 + (10, 2, 8, -1), 2.364 + (10, 2, 9, 1), 2.365 + (10, 2, 10, 3), 2.366 + (10, 2, 11, 2), 2.367 + (11, 2, 8, -1), 2.368 + (11, 2, 9, 1), 2.369 + (11, 2, 10, 3), 2.370 + (11, 2, 11, 2), 2.371 + (12, 2, 8, -1), 2.372 + (12, 2, 9, 1), 2.373 + (12, 2, 10, 3), 2.374 + (12, 2, 11, 2), 2.375 + (13, 2, 8, -1), 2.376 + (13, 2, 9, 1), 2.377 + (13, 2, 10, 3), 2.378 + (13, 2, 11, 2), 2.379 + (14, 2, 8, -1), 2.380 + (14, 2, 9, 1), 2.381 + (14, 2, 10, 3), 2.382 + (14, 2, 11, 2), 2.383 + (15, 2, 8, -1), 2.384 + (15, 2, 9, -3), 2.385 + (15, 2, 10, -4), 2.386 + (15, 2, 11, -2), 2.387 + (16, 2, 8, -1), 2.388 + (16, 2, 9, -3), 2.389 + (16, 2, 10, -4), 2.390 + (16, 2, 11, -2), 2.391 + (17, 2, 8, -1), 2.392 + (17, 2, 9, -3), 2.393 + (17, 2, 10, -4), 2.394 + (17, 2, 11, -2), 2.395 + (18, 2, 8, -1), 2.396 + (18, 2, 9, 1), 2.397 + (18, 2, 10, -2), 2.398 + (18, 2, 11, 2), 2.399 + (19, 2, 8, -1), 2.400 + (19, 2, 9, 1), 2.401 + (19, 2, 10, -2), 2.402 + (19, 2, 11, 2), 2.403 + (20, 2, 8, 1), 2.404 + (20, 2, 9, 2), 2.405 + (20, 2, 10, -1), 2.406 + (20, 2, 11, 3); 2.407 + 2.408 +SELECT "time_warp"(); 2.409 + 2.410 +DROP FUNCTION "time_warp"(); 2.411 + 2.412 +-- Test policies that help with testing specific frontend parts 2.413 + 2.414 +INSERT INTO "policy" ( 2.415 + "index", 2.416 + "active", 2.417 + "name", 2.418 + "description", 2.419 + "admission_time", 2.420 + "discussion_time", 2.421 + "verification_time", 2.422 + "voting_time", 2.423 + "issue_quorum_num", 2.424 + "issue_quorum_den", 2.425 + "initiative_quorum_num", 2.426 + "initiative_quorum_den" 2.427 + ) VALUES ( 2.428 + 1, 2.429 + TRUE, 2.430 + 'Test New', 2.431 + DEFAULT, 2.432 + '2 days', 2.433 + '1 second', 2.434 + '1 second', 2.435 + '1 second', 2.436 + 0, 100, 2.437 + 0, 100 2.438 + ), ( 2.439 + 1, 2.440 + TRUE, 2.441 + 'Test Accept', 2.442 + DEFAULT, 2.443 + '1 second', 2.444 + '2 days', 2.445 + '1 second', 2.446 + '1 second', 2.447 + 0, 100, 2.448 + 0, 100 2.449 + ), ( 2.450 + 1, 2.451 + TRUE, 2.452 + 'Test Frozen', 2.453 + DEFAULT, 2.454 + '1 second', 2.455 + '5 minutes', 2.456 + '2 days', 2.457 + '1 second', 2.458 + 0, 100, 2.459 + 0, 100 2.460 + ), ( 2.461 + 1, 2.462 + TRUE, 2.463 + 'Test Voting', 2.464 + DEFAULT, 2.465 + '1 second', 2.466 + '5 minutes', 2.467 + '1 second', 2.468 + '2 days', 2.469 + 0, 100, 2.470 + 0, 100 2.471 + ); 2.472 +END; 2.473 +