comparison createdb.php @ 88:784953d60ba5

More work on test data generation.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Oct 2013 09:56:00 +0300
parents 50d6c69836a1
children 6fdde6aca7ba
comparison
equal deleted inserted replaced
87:3da47d3e6a3c 88:784953d60ba5
162 "settings" => "key VARCHAR(32) PRIMARY KEY, vtype INT, vstr VARCHAR(128), vtext TEXT, vint INT, desc VARCHAR(128)", 162 "settings" => "key VARCHAR(32) PRIMARY KEY, vtype INT, vstr VARCHAR(128), vtext TEXT, vint INT, desc VARCHAR(128)",
163 "news" => "id INTEGER PRIMARY KEY AUTOINCREMENT, utime INT, title VARCHAR(128), text VARCHAR(4096), author VARCHAR(64), persist INT DEFAULT 0", 163 "news" => "id INTEGER PRIMARY KEY AUTOINCREMENT, utime INT, title VARCHAR(128), text VARCHAR(4096), author VARCHAR(64), persist INT DEFAULT 0",
164 "compos" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(128), description VARCHAR(4096), visible INT DEFAULT 0, voting INT DEFAULT 0, showAuthors INT DEFAULT 0", 164 "compos" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(128), description VARCHAR(4096), visible INT DEFAULT 0, voting INT DEFAULT 0, showAuthors INT DEFAULT 0",
165 "entries" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(64), author VARCHAR(64), compo_id INT DEFAULT NULL, filename VARCHAR(256) DEFAULT NULL", 165 "entries" => "id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(64), author VARCHAR(64), compo_id INT DEFAULT NULL, filename VARCHAR(256) DEFAULT NULL",
166 166
167 "attendees" => "id INTEGER PRIMARY KEY AUTOINCREMENT, regtime INT, name VARCHAR(64), groups VARCHAR(64), oneliner VARCHAR(64), email VARCHAR(80), key VARCHAR(64), active INT DEFAULT 0", 167 "attendees" => "id INTEGER PRIMARY KEY AUTOINCREMENT, regtime INT, name VARCHAR(64), groups VARCHAR(64), oneliner VARCHAR(64), email VARCHAR(80), key_id INT DEFAULT NULL",
168 168
169 "votekeys" => "id INTEGER PRIMARY KEY AUTOINCREMENT, key VARCHAR(64), active INT DEFAULT 0",
170
169 "votes" => "id INTEGER PRIMARY KEY AUTOINCREMENT, entry_id INT DEFAULT NULL, voter_id INT DEFAULT NULL, value INT DEFAULT 0", 171 "votes" => "id INTEGER PRIMARY KEY AUTOINCREMENT, entry_id INT DEFAULT NULL, voter_id INT DEFAULT NULL, value INT DEFAULT 0",
170 ); 172 );
171 173
172 $siteTestData = array( 174 $siteTestData = array(
173 "news" => array( 175 "news" => array(
175 time().",%s,%s,%s", 177 time().",%s,%s,%s",
176 array("Today's news", "We. Are. Back.", "orgaz"), 178 array("Today's news", "We. Are. Back.", "orgaz"),
177 array("Good news, everybody!", "...", "The Professor"), 179 array("Good news, everybody!", "...", "The Professor"),
178 ), 180 ),
179 181
182 "votekeys" => array(
183 "key",
184 "%s",
185 array("k5nYXNjQ"),
186 array("msD3mDqH"),
187 array("7jjnqt5z"),
188 array("c7jcfk1G"),
189 ),
190
180 "attendees" => array( 191 "attendees" => array(
181 "regtime,name,groups,oneliner,email,key", 192 "regtime,name,groups,oneliner,email",
182 "%d,%s,%s,%s,%s,%s", 193 "%d,%s,%s,%s,%s",
183 array(time()-0, "man with no alias", "supergroup", "foo-bar", "c@supergroup.com", "12t3454"), 194 array(time()-0, "man with no alias", "supergroup", "foo-bar", "c@supergroup.com"),
184 array(time()-15, "man with alias", "supergroup", "hi!", "c@supergroup.com", "123e45fd4"), 195 array(time()-15, "man with alias", "supergroup", "hi!", "c@supergroup.com"),
185 array(time()-30, "alias with a man", "supergroup", "mega super kewl rulets", "x@microsoft.com", "4346zxc54"), 196 array(time()-30, "alias with a man", "supergroup", "mega super kewl rulets", "x@microsoft.com"),
186 ), 197 ),
187 198
188 "compos" => array( 199 "compos" => array(
189 "name,description,visible,voting", 200 "name,description,visible,voting",
190 "%s,%s,1,1", 201 "%s,%s,1,1",
197 "%s,%s,%d,%s", 208 "%s,%s,%d,%s",
198 array("my dong", "visualice", 1, "juice.lbm"), 209 array("my dong", "visualice", 1, "juice.lbm"),
199 array("penis song", "reed/flt", 2, "penis.mod"), 210 array("penis song", "reed/flt", 2, "penis.mod"),
200 ), 211 ),
201 ); 212 );
213
202 214
203 // 215 //
204 // Helper functions 216 // Helper functions
205 // 217 //
206 function stConnectDB($dbspec) 218 function stConnectDB($dbspec)
317 329
318 echo "Using database spec '".$spec."'.\n"; 330 echo "Using database spec '".$spec."'.\n";
319 331
320 332
321 // Act according to specified command 333 // Act according to specified command
334 $addData = FALSE;
322 switch (stCArgLC(1)) 335 switch (stCArgLC(1))
323 { 336 {
324 case "test": 337 case "test":
325 $addData = TRUE; 338 $addData = TRUE;
326 339