
jbe@0: -- NOTE: This file requires that sequence generators have not been used.
jbe@0: -- (All new rows need to start with id '1'.)
jbe@0: 
jbe@0: BEGIN;
jbe@0: 
jbe@0: INSERT INTO "member" ("login", "name") VALUES
jbe@0:   ('user1',  'User #1'),   -- id  1
jbe@0:   ('user2',  'User #2'),   -- id  2
jbe@0:   ('user3',  'User #3'),   -- id  3
jbe@0:   ('user4',  'User #4'),   -- id  4
jbe@0:   ('user5',  'User #5'),   -- id  5
jbe@0:   ('user6',  'User #6'),   -- id  6
jbe@0:   ('user7',  'User #7'),   -- id  7
jbe@0:   ('user8',  'User #8'),   -- id  8
jbe@0:   ('user9',  'User #9'),   -- id  9
jbe@0:   ('user10', 'User #10'),  -- id 10
jbe@0:   ('user11', 'User #11'),  -- id 11
jbe@0:   ('user12', 'User #12'),  -- id 12
jbe@0:   ('user13', 'User #13'),  -- id 13
jbe@0:   ('user14', 'User #14'),  -- id 14
jbe@0:   ('user15', 'User #15'),  -- id 15
jbe@0:   ('user16', 'User #16'),  -- id 16
jbe@0:   ('user17', 'User #17'),  -- id 17
jbe@0:   ('user18', 'User #18'),  -- id 18
jbe@0:   ('user19', 'User #19'),  -- id 19
jbe@0:   ('user20', 'User #20'),  -- id 20
jbe@0:   ('user21', 'User #21'),  -- id 21
jbe@0:   ('user22', 'User #22'),  -- id 22
jbe@0:   ('user23', 'User #23');  -- id 23
jbe@0: 
poelzi@77: -- set password to "login"
poelzi@77: UPDATE "member" SET "password" = '$1$PcI6b1Bg$2SHjAZH2nMLFp0fxHis.Q0';
jbe@0: 
jbe@0: INSERT INTO "policy" (
jbe@9:         "index",
jbe@0:         "name",
jbe@3:         "admission_time",
jbe@3:         "discussion_time",
jbe@3:         "verification_time",
jbe@3:         "voting_time",
jbe@0:         "issue_quorum_num", "issue_quorum_den",
jbe@0:         "initiative_quorum_num", "initiative_quorum_den"
jbe@0:     ) VALUES (
jbe@9:         1,
jbe@0:         'Default policy',
jbe@3:         '1 hour', '1 hour', '1 hour', '1 hour',
jbe@0:         25, 100,
jbe@0:         20, 100 );
jbe@0: 
jbe@3: CREATE FUNCTION "time_warp"() RETURNS VOID
jbe@3:   LANGUAGE 'plpgsql' VOLATILE AS $$
jbe@3:     BEGIN
jbe@3:       UPDATE "issue" SET
jbe@3:         "snapshot"     = "snapshot"     - '1 hour 1 minute'::INTERVAL,
jbe@3:         "created"      = "created"      - '1 hour 1 minute'::INTERVAL,
jbe@3:         "accepted"     = "accepted"     - '1 hour 1 minute'::INTERVAL,
jbe@3:         "half_frozen"  = "half_frozen"  - '1 hour 1 minute'::INTERVAL,
jbe@3:         "fully_frozen" = "fully_frozen" - '1 hour 1 minute'::INTERVAL;
jbe@3:       PERFORM "check_everything"();
jbe@3:       RETURN;
jbe@3:     END;
jbe@3:   $$;
jbe@3: 
jbe@0: INSERT INTO "area" ("name") VALUES
jbe@0:   ('Area #1'),  -- id 1
jbe@0:   ('Area #2'),  -- id 2
jbe@0:   ('Area #3'),  -- id 3
jbe@0:   ('Area #4');  -- id 4
jbe@0: 
jbe@9: INSERT INTO "allowed_policy" ("area_id", "policy_id", "default_policy")
jbe@9:   VALUES (1, 1, TRUE), (2, 1, TRUE), (3, 1, TRUE), (4, 1, TRUE);
jbe@9: 
jbe@0: INSERT INTO "membership" ("area_id", "member_id", "autoreject") VALUES
jbe@0:   (1,  9, FALSE),
jbe@0:   (1, 19, FALSE),
jbe@0:   (2,  9, TRUE),
jbe@0:   (2, 10, TRUE),
jbe@0:   (2, 17, TRUE),
jbe@0:   (3,  9, FALSE),
jbe@0:   (3, 11, FALSE),
jbe@0:   (3, 12, TRUE),
jbe@0:   (3, 14, FALSE),
jbe@0:   (3, 20, FALSE),
jbe@0:   (3, 21, TRUE),
jbe@0:   (3, 22, TRUE),
jbe@0:   (4,  6, FALSE),
jbe@0:   (4,  9, FALSE),
jbe@0:   (4, 13, FALSE),
jbe@0:   (4, 22, TRUE);
jbe@0: 
jbe@0: -- global delegations
jbe@0: INSERT INTO "delegation"
jbe@10:   ("truster_id", "scope", "trustee_id") VALUES
jbe@10:   ( 1, 'global',  9),
jbe@10:   ( 2, 'global', 11),
jbe@10:   ( 3, 'global', 12),
jbe@10:   ( 4, 'global', 13),
jbe@10:   ( 5, 'global', 14),
jbe@10:   ( 6, 'global',  7),
jbe@10:   ( 7, 'global',  8),
jbe@10:   ( 8, 'global',  6),
jbe@10:   (10, 'global',  9),
jbe@10:   (11, 'global',  9),
jbe@10:   (12, 'global', 21),
jbe@10:   (15, 'global', 10),
jbe@10:   (16, 'global', 17),
jbe@10:   (17, 'global', 19),
jbe@10:   (18, 'global', 19),
jbe@10:   (23, 'global', 22);
jbe@0: 
jbe@0: -- delegations for topics
jbe@0: INSERT INTO "delegation"
jbe@10:   ("area_id", "truster_id", "scope", "trustee_id") VALUES
jbe@10:   (1,  3, 'area', 17),
jbe@10:   (2,  5, 'area', 10),
jbe@10:   (2,  9, 'area', 10),
jbe@10:   (3,  4, 'area', 14),
jbe@10:   (3, 16, 'area', 20),
jbe@10:   (3, 19, 'area', 20),
jbe@10:   (4,  5, 'area', 13),
jbe@10:   (4, 12, 'area', 22);
jbe@0: 
jbe@0: INSERT INTO "issue" ("area_id", "policy_id") VALUES
jbe@0:   (3, 1);  -- id 1
jbe@0: 
jbe@0: INSERT INTO "initiative" ("issue_id", "name") VALUES
jbe@0:   (1, 'Initiative #1'),  -- id 1
jbe@0:   (1, 'Initiative #2'),  -- id 2
jbe@0:   (1, 'Initiative #3'),  -- id 3
jbe@0:   (1, 'Initiative #4'),  -- id 4
jbe@0:   (1, 'Initiative #5'),  -- id 5
jbe@0:   (1, 'Initiative #6'),  -- id 6
jbe@0:   (1, 'Initiative #7');  -- id 7
jbe@0: 
jbe@0: INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES
jbe@0:   (1, 17, 'Lorem ipsum...'),  -- id 1
jbe@0:   (2, 20, 'Lorem ipsum...'),  -- id 2
jbe@0:   (3, 20, 'Lorem ipsum...'),  -- id 3
jbe@0:   (4, 20, 'Lorem ipsum...'),  -- id 4
jbe@0:   (5, 14, 'Lorem ipsum...'),  -- id 5
jbe@0:   (6, 11, 'Lorem ipsum...'),  -- id 6
jbe@0:   (7, 12, 'Lorem ipsum...');  -- id 7
jbe@0: 
jbe@0: INSERT INTO "initiator" ("initiative_id", "member_id") VALUES
jbe@0:   (1, 17),
jbe@0:   (1, 19),
jbe@0:   (2, 20),
jbe@0:   (3, 20),
jbe@0:   (4, 20),
jbe@0:   (5, 14),
jbe@0:   (6, 11),
jbe@0:   (7, 12);
jbe@0: 
jbe@0: INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES
jbe@0:   ( 7,  4,  4),
jbe@0:   ( 8,  2,  2),
jbe@0:   (11,  6,  6),
jbe@0:   (12,  7,  7),
jbe@0:   (14,  1,  1),
jbe@0:   (14,  2,  2),
jbe@0:   (14,  3,  3),
jbe@0:   (14,  4,  4),
jbe@0:   (14,  5,  5),
jbe@0:   (14,  6,  6),
jbe@0:   (14,  7,  7),
jbe@0:   (17,  1,  1),
jbe@0:   (17,  3,  3),
jbe@0:   (19,  1,  1),
jbe@0:   (19,  2,  2),
jbe@0:   (20,  1,  1),
jbe@0:   (20,  2,  2),
jbe@0:   (20,  3,  3),
jbe@0:   (20,  4,  4),
jbe@0:   (20,  5,  5);
jbe@0: 
jbe@0: INSERT INTO "suggestion" ("initiative_id", "author_id", "name", "description") VALUES
jbe@0:   (1, 19, 'Suggestion #1', 'Lorem ipsum...');  -- id 1
jbe@0: INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES
jbe@0:   (14, 1, 2, FALSE);
jbe@0: INSERT INTO "opinion" ("member_id", "suggestion_id", "degree", "fulfilled") VALUES
jbe@0:   (19, 1, 2, FALSE);
jbe@0: 
jbe@3: SELECT "time_warp"();
jbe@3: SELECT "time_warp"();
jbe@3: SELECT "time_warp"();
jbe@0: 
jbe@0: INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES
jbe@0:   ( 8, 1),
jbe@0:   ( 9, 1),
jbe@0:   (11, 1),
jbe@0:   (12, 1),
jbe@0:   (14, 1),
jbe@0:   (19, 1),
jbe@0:   (20, 1),
jbe@0:   (21, 1);
jbe@0: 
jbe@0: INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES
jbe@0:   ( 8, 1, 1,  1),
jbe@0:   ( 8, 1, 2,  1),
jbe@0:   ( 8, 1, 3,  1),
jbe@0:   ( 8, 1, 4,  1),
jbe@0:   ( 8, 1, 5,  1),
jbe@0:   ( 8, 1, 6, -1),
jbe@0:   ( 8, 1, 7, -1),
jbe@0:   ( 9, 1, 1, -2),
jbe@0:   ( 9, 1, 2, -3),
jbe@0:   ( 9, 1, 3, -2),
jbe@0:   ( 9, 1, 4, -2),
jbe@0:   ( 9, 1, 5, -2),
jbe@0:   ( 9, 1, 6, -1),
jbe@0:   (11, 1, 1, -1),
jbe@0:   (11, 1, 2, -1),
jbe@0:   (11, 1, 3, -1),
jbe@0:   (11, 1, 4, -1),
jbe@0:   (11, 1, 5, -1),
jbe@0:   (11, 1, 6,  2),
jbe@0:   (11, 1, 7,  1),
jbe@0:   (12, 1, 1, -1),
jbe@0:   (12, 1, 3, -1),
jbe@0:   (12, 1, 4, -1),
jbe@0:   (12, 1, 5, -1),
jbe@0:   (12, 1, 6, -2),
jbe@0:   (12, 1, 7,  1),
jbe@0:   (14, 1, 1,  1),
jbe@0:   (14, 1, 2,  3),
jbe@0:   (14, 1, 3,  1),
jbe@0:   (14, 1, 4,  2),
jbe@0:   (14, 1, 5,  1),
jbe@0:   (14, 1, 6,  1),
jbe@0:   (14, 1, 7,  1),
jbe@0:   (19, 1, 1,  3),
jbe@0:   (19, 1, 2,  4),
jbe@0:   (19, 1, 3,  2),
jbe@0:   (19, 1, 4,  2),
jbe@0:   (19, 1, 5,  2),
jbe@0:   (19, 1, 7,  1),
jbe@0:   (20, 1, 1,  1),
jbe@0:   (20, 1, 2,  2),
jbe@0:   (20, 1, 3,  1),
jbe@0:   (20, 1, 4,  1),
jbe@0:   (20, 1, 5,  1),
jbe@0:   (21, 1, 5, -1);
jbe@0: 
jbe@3: SELECT "time_warp"();
jbe@3: 
jbe@3: DROP FUNCTION "time_warp"();
jbe@0: 
jbe@0: END;
jbe@0: 




