diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2013-01-23 15:39:27 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-01-23 15:39:27 +0100 |
commit | 0bdaa1b9f2cdb79a761065d52a5e02b61d0e2d29 (patch) | |
tree | b4f489b94beafa14d62a0b03aa543dfc4be5dc4a | |
parent | f732320431a55c9d2d3ca25030ddd86791a56356 (diff) |
Update sql schema with our local habits
-rw-r--r-- | vote/include/schema.sql | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/vote/include/schema.sql b/vote/include/schema.sql index 68df66e..4388d50 100644 --- a/vote/include/schema.sql +++ b/vote/include/schema.sql @@ -1,3 +1,16 @@ + 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'; + CREATE TABLE `elections` ( `id` int(11) NOT NULL auto_increment, `type` enum('elections','referendum') NOT NULL default 'elections', @@ -25,9 +38,11 @@ ) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8; CREATE TABLE `election_tmp_tokens` ( + `id` int(11) NOT NULL auto_increment, `election_id` int(11) NOT NULL default '0', `member_id` int(11) NOT NULL default '0', `tmp_token` varchar(200) NOT NULL default '' + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /* @@ -36,8 +51,6 @@ from members database we prepare anon tokens 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 -<bolsh> There's "election_votes" and "foundationmembers" too - I'm not sure if there's a join done between foundationmembers and the other tables */ CREATE TABLE `election_votes` ( |