liquid_feedback_core
annotate init.sql @ 126:5edfb00d840a
Implementation of Schulze's Supermajority Requirements
Changes in detail:
- Renamed column "agreed" of table "initiative" to "majority"
- Added column "winner" to table "initiative"
- Extended constraint "non_admitted_initiatives_cant_contain_voting_results" of table "initiative" to "rank" and "winner" columns
- Removed constraint "non_agreed_initiatives_cant_get_a_rank" from table "initiative"
- Replaced PRIMARY KEY of "battle" table by a single NOT NULL constraint on column "issue_id" and three (partial) indicies allowing NULL values as initiative ids
- Added constraint "initiative_ids_not_equal" to "battle" table
- Added view "battle_participant" which selects admitted initiatives plus one virtual "status-quo" initiative for each issue denoted by an initiative_id being NULL
- Modified "battle_view" to include all admitted initiatives plus the virtual "status-quo" initiative
- Modified function "calculate_ranks" to respect all battle participants, to set the rank of all initiatives where the rank is better than status-quo, and to mark the final winner (if existent)
Changes in detail:
- Renamed column "agreed" of table "initiative" to "majority"
- Added column "winner" to table "initiative"
- Extended constraint "non_admitted_initiatives_cant_contain_voting_results" of table "initiative" to "rank" and "winner" columns
- Removed constraint "non_agreed_initiatives_cant_get_a_rank" from table "initiative"
- Replaced PRIMARY KEY of "battle" table by a single NOT NULL constraint on column "issue_id" and three (partial) indicies allowing NULL values as initiative ids
- Added constraint "initiative_ids_not_equal" to "battle" table
- Added view "battle_participant" which selects admitted initiatives plus one virtual "status-quo" initiative for each issue denoted by an initiative_id being NULL
- Modified "battle_view" to include all admitted initiatives plus the virtual "status-quo" initiative
- Modified function "calculate_ranks" to respect all battle participants, to set the rank of all initiatives where the rank is better than status-quo, and to mark the final winner (if existent)
author | jbe |
---|---|
date | Tue May 24 03:01:49 2011 +0200 (2011-05-24) |
parents | 58451b5565ae |
children | 6fce4f08157b |
rev | line source |
---|---|
jbe@0 | 1 -- NOTE: This file creates an admin user with an empty password! |
jbe@0 | 2 |
jbe@0 | 3 BEGIN; |
jbe@0 | 4 |
jbe@97 | 5 INSERT INTO "unit" ( |
jbe@97 | 6 "active", |
jbe@97 | 7 "name", |
jbe@97 | 8 "description" |
jbe@97 | 9 ) VALUES ( |
jbe@97 | 10 true, |
jbe@97 | 11 'Default unit', |
jbe@97 | 12 'Default unit created by init script.' |
jbe@97 | 13 ); |
jbe@97 | 14 |
jbe@97 | 15 |
jbe@0 | 16 INSERT INTO "member" ( |
jbe@0 | 17 "login", |
jbe@0 | 18 "password", |
jbe@0 | 19 "active", |
jbe@0 | 20 "admin", |
jbe@7 | 21 "name" |
jbe@0 | 22 ) VALUES ( |
jbe@0 | 23 'admin', |
jbe@9 | 24 '$1$.EMPTY.$LDufa24OE2HZFXAXh71Eb1', |
jbe@0 | 25 TRUE, |
jbe@0 | 26 TRUE, |
jbe@7 | 27 'Administrator' ); |
jbe@0 | 28 |
jbe@0 | 29 INSERT INTO "policy" ( |
jbe@9 | 30 "index", |
jbe@0 | 31 "active", |
jbe@0 | 32 "name", |
jbe@0 | 33 "description", |
jbe@0 | 34 "admission_time", |
jbe@0 | 35 "discussion_time", |
jbe@7 | 36 "verification_time", |
jbe@0 | 37 "voting_time", |
jbe@0 | 38 "issue_quorum_num", |
jbe@0 | 39 "issue_quorum_den", |
jbe@0 | 40 "initiative_quorum_num", |
jbe@0 | 41 "initiative_quorum_den" |
jbe@0 | 42 ) VALUES ( |
jbe@9 | 43 1, |
jbe@0 | 44 TRUE, |
jbe@0 | 45 'Extensive proceeding', |
jbe@0 | 46 DEFAULT, |
jbe@0 | 47 '1 month', |
jbe@7 | 48 '5 months', |
jbe@7 | 49 '1 month', |
jbe@0 | 50 '3 weeks', |
jbe@7 | 51 10, 100, |
jbe@7 | 52 10, 100 |
jbe@0 | 53 ), ( |
jbe@9 | 54 2, |
jbe@0 | 55 TRUE, |
jbe@0 | 56 'Standard proceeding', |
jbe@0 | 57 DEFAULT, |
jbe@7 | 58 '1 month', |
jbe@0 | 59 '1 month', |
jbe@0 | 60 '1 week', |
jbe@7 | 61 '1 week', |
jbe@7 | 62 10, 100, |
jbe@7 | 63 10, 100 |
jbe@0 | 64 ), ( |
jbe@9 | 65 3, |
jbe@0 | 66 TRUE, |
jbe@0 | 67 'Fast proceeding', |
jbe@0 | 68 DEFAULT, |
jbe@7 | 69 '48 hours', |
jbe@7 | 70 '3 hours', |
jbe@7 | 71 '1 hour', |
jbe@0 | 72 '20 hours', |
jbe@7 | 73 1, 100, |
jbe@0 | 74 1, 100 ); |
jbe@0 | 75 |
jbe@0 | 76 INSERT INTO "area" ( |
jbe@97 | 77 "unit_id", |
jbe@0 | 78 "active", |
jbe@0 | 79 "name", |
jbe@0 | 80 "description" |
jbe@0 | 81 ) VALUES ( |
jbe@97 | 82 1, |
jbe@0 | 83 TRUE, |
jbe@0 | 84 'Generic area', |
jbe@0 | 85 DEFAULT ); |
jbe@0 | 86 |
jbe@0 | 87 COMMIT; |