diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-02-19 13:36:54 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-02-19 13:36:54 +0100 |
commit | c5e8568a01780ca2ed3106e2508c656312945573 (patch) | |
tree | 9c12af61f647fa9353db1cb16193091b2239e900 | |
parent | 6cf33bb677df1cdf8e8166ed5197e9c3d2310445 (diff) |
Make schema actually importable.
-rw-r--r-- | vote/include/schema.sql | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/vote/include/schema.sql b/vote/include/schema.sql index 4388d50..4b756f8 100644 --- a/vote/include/schema.sql +++ b/vote/include/schema.sql @@ -1,15 +1,6 @@ CREATE database elections; - /* this user has elevated rights - not to be used from php */ - CREATE USER 'voting'@'localhost' IDENTIFIED BY 'secure_pw'; - GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON elections.* TO 'voting'@'localhost'; - - /* this user has lowest-possible rights - to be used from php */ - CREATE USER 'web'@'localhost' IDENTIFIED BY 'whatever'; - GRANT SELECT ON elections.* TO 'web'@'localhost'; - GRANT SELECT,INSERT ON elections.election_anon_tokens TO 'web'@'localhost'; - GRANT SELECT,INSERT ON elections.election_votes TO 'web'@'localhost'; - GRANT SELECT,DELETE ON elections.election_tmp_tokens TO 'web'@'localhost'; + use elections; CREATE TABLE `elections` ( `id` int(11) NOT NULL auto_increment, @@ -46,25 +37,36 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* -from members database we prepare anon tokens + from members database we prepare anon tokens then insert those anon tokens to database of course before a new election record should be created since its id is needed for anon_tokens and election_choices are to be inserted rest is handled by itself iirc */ -CREATE TABLE `election_votes` ( + CREATE TABLE `election_votes` ( `id` int(11) NOT NULL auto_increment, `choice_id` int(11) NOT NULL default '0', `anon_id` int(11) NOT NULL default '0', `preference` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=InnoDB; + ) ENGINE=InnoDB; -CREATE TABLE `election_results` ( + CREATE TABLE `election_results` ( `id` int(11) NOT NULL auto_increment, `election_id` int(11) NOT NULL default '0', `result` text NOT NULL, PRIMARY KEY (`id`) -) DEFAULT CHARSET=utf8; + ) DEFAULT CHARSET=utf8; + + /* this user has elevated rights - not to be used from php */ + CREATE USER 'voting'@'localhost' IDENTIFIED BY 'secure_pw'; + GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON elections.* TO 'voting'@'localhost'; + + /* this user has lowest-possible rights - to be used from php */ + CREATE USER 'web'@'localhost' IDENTIFIED BY 'whatever'; + GRANT SELECT ON elections.* TO 'web'@'localhost'; + GRANT SELECT,INSERT ON elections.election_anon_tokens TO 'web'@'localhost'; + GRANT SELECT,INSERT ON elections.election_votes TO 'web'@'localhost'; + GRANT SELECT,DELETE ON elections.election_tmp_tokens TO 'web'@'localhost'; |