wbond / flourish (http://flourishlib.com/)
Flourish is a PHP unframework — a general-purpose, object-oriented library. It's architecture is modular and thus not strictly MVC. It focuses on being secure, broadly compatible, portable, well documented and easy to use.
| commit 729: | 16d99e48403c |
| parent 728: | 7d1ef15048ed |
| branch: | trunk |
Changed (Δ9.6 KB):
classes/fActiveRecord.php (3 lines added, 2 lines removed)
classes/fORMOrdering.php (4 lines added, 3 lines removed)
classes/fSchema.php (3 lines added, 2 lines removed)
tests/classes/fActiveRecord/fActiveRecordTest.php (1 lines added, 0 lines removed)
tests/classes/fORMOrdering/fORMOrderingTest.php (122 lines added, 0 lines removed)
tests/database/setup-extended.mssql.sql (15 lines added, 0 lines removed)
tests/database/setup-extended.mysql.sql (16 lines added, 0 lines removed)
tests/database/setup-extended.oracle.sql (15 lines added, 0 lines removed)
tests/database/setup-extended.postgresql.sql (15 lines added, 0 lines removed)
tests/database/setup-extended.sqlite.sql (15 lines added, 0 lines removed)
tests/database/teardown-extended.mssql.sql (1 lines added, 0 lines removed)
tests/database/teardown-extended.mysql.sql (1 lines added, 1 lines removed)
tests/database/teardown-extended.oracle.sql (1 lines added, 0 lines removed)
tests/database/teardown-extended.postgresql.sql (1 lines added, 0 lines removed)
tests/database/teardown-extended.sqlite.sql (1 lines added, 0 lines removed)
Up to file-list classes/fActiveRecord.php:
15 |
15 |
* @package Flourish |
16 |
16 |
* @link http://flourishlib.com/fActiveRecord |
17 |
17 |
* |
18 |
* @version 1.0.0b |
|
18 |
* @version 1.0.0b50 |
|
19 |
* @changes 1.0.0b50 Fixed a bug with trying to load by a multi-column primary key where one of the columns was not specified [wb, 2009-11-13] |
|
19 |
20 |
* @changes 1.0.0b49 Fixed a bug affecting where conditions with columns that are not null but have a default value [wb, 2009-11-03] |
20 |
21 |
* @changes 1.0.0b48 Updated code for the new fORMDatabase and fORMSchema APIs [wb, 2009-10-28] |
21 |
22 |
* @changes 1.0.0b47 Changed `::associate{RelatedRecords}()`, `::link{RelatedRecords}()` and `::populate{RelatedRecords}()` to allow for method chaining [wb, 2009-10-22] |
| … | … | @@ -1051,7 +1052,7 @@ abstract class fActiveRecord |
1051 |
1052 |
} |
1052 |
1053 |
} |
1053 |
1054 |
|
1054 |
$wrong_keys = is_array($key) && |
|
1055 |
$wrong_keys = is_array($key) && (count($key) != count($pk_columns) || array_diff(array_keys($key), $pk_columns)); |
|
1055 |
1056 |
$wrong_type = !is_array($key) && (sizeof($pk_columns) != 1 || !is_scalar($key)); |
1056 |
1057 |
|
1057 |
1058 |
// If we didn't find a UNIQUE key and primary key doesn't look right we fail |
Up to file-list classes/fORMOrdering.php:
10 |
10 |
* @package Flourish |
11 |
11 |
* @link http://flourishlib.com/fORMOrdering |
12 |
12 |
* |
13 |
* @version 1.0.0b1 |
|
13 |
* @version 1.0.0b15 |
|
14 |
* @changes 1.0.0b15 Fixed a bug with ordering columns that are part of a multi-column unique constraint [wb, 2009-11-13] |
|
14 |
15 |
* @changes 1.0.0b14 Fixed a bug affecting where conditions with columns that are not null but have a default value [wb, 2009-11-03] |
15 |
16 |
* @changes 1.0.0b13 Updated code for the new fORMDatabase and fORMSchema APIs [wb, 2009-10-28] |
16 |
17 |
* @changes 1.0.0b12 Changed SQL statements to use value placeholders, identifier escaping and schema support [wb, 2009-10-22] |
| … | … | @@ -156,7 +157,7 @@ class fORMOrdering |
156 |
157 |
$conditions[] = fORMDatabase::makeCondition($schema, $table, $other_column, '=', $value); |
157 |
158 |
} |
158 |
159 |
|
159 |
$params[0] .= join(' |
|
160 |
$params[0] .= join(' AND ', $conditions); |
|
160 |
161 |
|
161 |
162 |
return $params; |
162 |
163 |
} |
| … | … | @@ -191,7 +192,7 @@ class fORMOrdering |
191 |
192 |
$conditions[] = fORMDatabase::makeCondition($schema, $table, $other_column, '=', $value); |
192 |
193 |
} |
193 |
194 |
|
194 |
$params[0] .= join(' |
|
195 |
$params[0] .= join(' AND ', $conditions); |
|
195 |
196 |
|
196 |
197 |
return $params; |
197 |
198 |
} |
Up to file-list classes/fSchema.php:
9 |
9 |
* @package Flourish |
10 |
10 |
* @link http://flourishlib.com/fSchema |
11 |
11 |
* |
12 |
* @version 1.0.0b2 |
|
12 |
* @version 1.0.0b28 |
|
13 |
* @changes 1.0.0b28 Fixed a bug with detecting some multi-column unique constraints in SQL Server databases [wb, 2009-11-13] |
|
13 |
14 |
* @changes 1.0.0b27 Added a parameter to ::enableCaching() to provide a key token that will allow cached values to be shared between multiple databases with the same schema [wb, 2009-10-28] |
14 |
15 |
* @changes 1.0.0b26 Added the placeholder element to the output of ::getColumnInfo(), added support for PostgreSQL, MSSQL and Oracle "schemas", added support for parsing quoted SQLite identifiers [wb, 2009-10-22] |
15 |
16 |
* @changes 1.0.0b25 One-to-one relationships utilizing the primary key as a foreign key are now properly detected [wb, 2009-09-22] |
| … | … | @@ -562,7 +563,7 @@ class fSchema |
562 |
563 |
} |
563 |
564 |
|
564 |
565 |
if (isset($temp)) { |
565 |
if ($last_type == 'foreign' |
|
566 |
if ($last_type == 'foreign' || $last_type == 'unique') { |
|
566 |
567 |
if (!isset($keys[$last_table][$last_type])) { |
567 |
568 |
$keys[$last_table][$last_type] = array(); |
568 |
569 |
} |
Up to file-list tests/classes/fActiveRecord/fActiveRecordTest.php:
| … | … | @@ -10,6 +10,7 @@ class UserDetail extends fActiveRecord { |
10 |
10 |
class RecordDeal extends fActiveRecord { } |
11 |
11 |
class RecordLabel extends fActiveRecord { } |
12 |
12 |
class FavoriteAlbum extends fActiveRecord { } |
13 |
class YearFavoriteAlbum extends fActiveRecord { } |
|
13 |
14 |
class InvalidTable extends fActiveRecord { } |
14 |
15 |
|
15 |
16 |
class fActiveRecordTest extends PHPUnit_Framework_TestSuite |
Up to file-list tests/classes/fORMOrdering/fORMOrderingTest.php:
| … | … | @@ -9,6 +9,7 @@ class Song extends fActiveRecord { } |
9 |
9 |
class UserDetail extends fActiveRecord { } |
10 |
10 |
class RecordLabel extends fActiveRecord { } |
11 |
11 |
class FavoriteAlbum extends fActiveRecord { } |
12 |
class YearFavoriteAlbum extends fActiveRecord { } |
|
12 |
13 |
class InvalidTable extends fActiveRecord { } |
13 |
14 |
class TopAlbum extends fActiveRecord { } |
14 |
15 |
|
| … | … | @@ -25,6 +26,7 @@ class fORMOrderingTest extends PHPUnit_F |
25 |
26 |
fORMDatabase::attach($this->sharedFixture); |
26 |
27 |
fORMOrdering::configureOrderingColumn('TopAlbum', 'position'); |
27 |
28 |
fORMOrdering::configureOrderingColumn('FavoriteAlbum', 'position'); |
29 |
fORMOrdering::configureOrderingColumn('YearFavoriteAlbum', 'position'); |
|
28 |
30 |
} |
29 |
31 |
|
30 |
32 |
|
| … | … | @@ -311,6 +313,126 @@ class fORMOrderingTest extends PHPUnit_F |
311 |
313 |
} |
312 |
314 |
|
313 |
315 |
|
316 |
static public function reorderThreeColumnProvider() |
|
317 |
{ |
|
318 |
$output = array(); |
|
319 |
// Original order |
|
320 |
//$output[] = array('will@flourishlib.com', 2009, 1, 2, array(2, 1, 3, 7, 4)); |
|
321 |
$output[] = array('will@flourishlib.com', 2009, 1, 1, array(1, 2, 3, 7, 4)); |
|
322 |
$output[] = array('will@flourishlib.com', 2009, 2, 2, array(1, 2, 3, 7, 4)); |
|
323 |
$output[] = array('will@flourishlib.com', 2009, 4, 4, array(2, 1, 3, 4, 7)); |
|
324 |
$output[] = array('will@flourishlib.com', 2009, 7, 5, array(2, 1, 3, 4, 7)); |
|
325 |
$output[] = array('will@flourishlib.com', 2009, 2, 5, array(1, 3, 7, 4, 2)); |
|
326 |
$output[] = array('will@flourishlib.com', 2009, 1, 5, array(2, 3, 7, 4, 1)); |
|
327 |
||
328 |
return $output; |
|
329 |
} |
|
330 |
||
331 |
/** |
|
332 |
* @dataProvider reorderThreeColumnProvider |
|
333 |
*/ |
|
334 |
public function testReorderThreeColumn($email, $year, $album_id, $end_position, $resulting_order) |
|
335 |
{ |
|
336 |
$favorite_album = new YearFavoriteAlbum(array('email' => $email, 'year' => $year, 'album_id' => $album_id)); |
|
337 |
$favorite_album->setPosition($end_position); |
|
338 |
$favorite_album->store(); |
|
339 |
||
340 |
$expected_result = array(); |
|
341 |
foreach ($resulting_order as $index => $album_id) { |
|
342 |
$expected_result[] = array( |
|
343 |
'email' => $email, |
|
344 |
'position' => $index+1, |
|
345 |
'album_id' => $album_id |
|
346 |
); |
|
347 |
} |
|
348 |
||
349 |
$actual_result = $this->sharedFixture->translatedQuery("SELECT email, position, album_id FROM year_favorite_albums WHERE email = %s ORDER BY position ASC", $email)->fetchAllRows(); |
|
350 |
||
351 |
$this->assertEquals($expected_result, $actual_result); |
|
352 |
} |
|
353 |
||
354 |
||
355 |
static public function addThreeColumnProvider() |
|
356 |
{ |
|
357 |
$output = array(); |
|
358 |
// Original order |
|
359 |
//$output[] = array('will@flourishlib.com', 2009, 6, 1, array(2, 1, 3, 7, 4)); |
|
360 |
$output[] = array('will@flourishlib.com', 2009, 6, 1, array(6, 2, 1, 3, 7, 4)); |
|
361 |
$output[] = array('will@flourishlib.com', 2009, 6, 2, array(2, 6, 1, 3, 7, 4)); |
|
362 |
$output[] = array('will@flourishlib.com', 2009, 6, 3, array(2, 1, 6, 3, 7, 4)); |
|
363 |
$output[] = array('will@flourishlib.com', 2009, 6, 4, array(2, 1, 3, 6, 7, 4)); |
|
364 |
$output[] = array('will@flourishlib.com', 2009, 6, 5, array(2, 1, 3, 7, 6, 4)); |
|
365 |
$output[] = array('will@flourishlib.com', 2009, 6, 6, array(2, 1, 3, 7, 4, 6)); |
|
366 |
$output[] = array('will@flourishlib.com', 2009, 6, NULL, array(2, 1, 3, 7, 4, 6)); |
|
367 |
$output[] = array('will@flourishlib.com', 2009, 6, 9, array(2, 1, 3, 7, 4, 6)); |
|
368 |
||
369 |
return $output; |
|
370 |
} |
|
371 |
||
372 |
/** |
|
373 |
* @dataProvider addThreeColumnProvider |
|
374 |
*/ |
|
375 |
public function testAddThreeColumn($email, $year, $album_id, $position, $resulting_order) |
|
376 |
{ |
|
377 |
$favorite_album = new YearFavoriteAlbum(); |
|
378 |
$favorite_album->setAlbumId($album_id); |
|
379 |
$favorite_album->setEmail($email); |
|
380 |
$favorite_album->setPosition($position); |
|
381 |
$favorite_album->setYear($year); |
|
382 |
$favorite_album->store(); |
|
383 |
||
384 |
$expected_result = array(); |
|
385 |
foreach ($resulting_order as $index => $album_id) { |
|
386 |
$expected_result[] = array( |
|
387 |
'email' => $email, |
|
388 |
'position' => $index+1, |
|
389 |
'album_id' => $album_id |
|
390 |
); |
|
391 |
} |
|
392 |
||
393 |
$actual_result = $this->sharedFixture->translatedQuery("SELECT email, position, album_id FROM year_favorite_albums WHERE email = %s ORDER BY position ASC", $email)->fetchAllRows(); |
|
394 |
||
395 |
$this->assertEquals($expected_result, $actual_result); |
|
396 |
} |
|
397 |
||
398 |
||
399 |
static public function deleteThreeColumnProvider() |
|
400 |
{ |
|
401 |
$output = array(); |
|
402 |
// Original order |
|
403 |
//$output[] = array('will@flourishlib.com', 2009, 1, array(2, 1, 3, 7, 4)); |
|
404 |
$output[] = array('will@flourishlib.com', 2009, 2, array(1, 3, 7, 4)); |
|
405 |
$output[] = array('will@flourishlib.com', 2009, 1, array(2, 3, 7, 4)); |
|
406 |
$output[] = array('will@flourishlib.com', 2009, 3, array(2, 1, 7, 4)); |
|
407 |
$output[] = array('will@flourishlib.com', 2009, 7, array(2, 1, 3, 4)); |
|
408 |
$output[] = array('will@flourishlib.com', 2009, 4, array(2, 1, 3, 7)); |
|
409 |
||
410 |
return $output; |
|
411 |
} |
|
412 |
||
413 |
/** |
|
414 |
* @dataProvider deleteThreeColumnProvider |
|
415 |
*/ |
|
416 |
public function testDeleteThreeColumn($email, $year, $album_id, $resulting_order) |
|
417 |
{ |
|
418 |
$favorite_album = new YearFavoriteAlbum(array('email' => $email, 'year' => $year, 'album_id' => $album_id)); |
|
419 |
$favorite_album->delete(); |
|
420 |
||
421 |
$expected_result = array(); |
|
422 |
foreach ($resulting_order as $index => $album_id) { |
|
423 |
$expected_result[] = array( |
|
424 |
'email' => $email, |
|
425 |
'position' => $index+1, |
|
426 |
'album_id' => $album_id |
|
427 |
); |
|
428 |
} |
|
429 |
||
430 |
$actual_result = $this->sharedFixture->translatedQuery("SELECT email, position, album_id FROM year_favorite_albums WHERE email = %s ORDER BY position ASC", $email)->fetchAllRows(); |
|
431 |
||
432 |
$this->assertEquals($expected_result, $actual_result); |
|
433 |
} |
|
434 |
||
435 |
||
314 |
436 |
static public function inspectProvider() |
315 |
437 |
{ |
316 |
438 |
$output = array(); |
Up to file-list tests/database/setup-extended.mssql.sql:
| … | … | @@ -21,6 +21,15 @@ CREATE TABLE favorite_albums ( |
21 |
21 |
PRIMARY KEY (email, album_id) |
22 |
22 |
); |
23 |
23 |
|
24 |
CREATE TABLE year_favorite_albums ( |
|
25 |
email VARCHAR(200) NOT NULL REFERENCES users(email_address) ON UPDATE CASCADE ON DELETE CASCADE, |
|
26 |
year INTEGER NOT NULL, |
|
27 |
album_id INTEGER NOT NULL REFERENCES albums(album_id) ON DELETE CASCADE, |
|
28 |
position INTEGER NOT NULL, |
|
29 |
UNIQUE (email, year, position), |
|
30 |
PRIMARY KEY (email, year, album_id) |
|
31 |
); |
|
32 |
||
24 |
33 |
CREATE TABLE top_albums ( |
25 |
34 |
top_album_id INTEGER IDENTITY(1,1) PRIMARY KEY, |
26 |
35 |
album_id INTEGER NOT NULL UNIQUE REFERENCES albums(album_id) ON DELETE CASCADE, |
| … | … | @@ -63,6 +72,12 @@ INSERT INTO favorite_albums (email, albu |
63 |
72 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 7, 4); |
64 |
73 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 4, 5); |
65 |
74 |
|
75 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 2, 1); |
|
76 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 1, 2); |
|
77 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 3, 3); |
|
78 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 7, 4); |
|
79 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 4, 5); |
|
80 |
||
66 |
81 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('john@smith.com', 2, 1); |
67 |
82 |
|
68 |
83 |
INSERT INTO events (title, start_date, end_date) VALUES ('First Event', '2008-01-01', '2008-01-01'); |
Up to file-list tests/database/setup-extended.mysql.sql:
| … | … | @@ -24,6 +24,16 @@ CREATE TABLE favorite_albums ( |
24 |
24 |
PRIMARY KEY (email, album_id) |
25 |
25 |
)ENGINE=InnoDB; |
26 |
26 |
|
27 |
CREATE TABLE year_favorite_albums ( |
|
28 |
email VARCHAR(200) NOT NULL, |
|
29 |
year INTEGER NOT NULL, |
|
30 |
album_id INTEGER NOT NULL REFERENCES albums(album_id) ON DELETE CASCADE, |
|
31 |
position INTEGER NOT NULL, |
|
32 |
UNIQUE (email, year, position), |
|
33 |
FOREIGN KEY (email) REFERENCES users(email_address) ON UPDATE CASCADE ON DELETE CASCADE, |
|
34 |
PRIMARY KEY (email, year, album_id) |
|
35 |
)ENGINE=InnoDB; |
|
36 |
||
27 |
37 |
CREATE TABLE top_albums ( |
28 |
38 |
top_album_id INTEGER PRIMARY KEY AUTO_INCREMENT, |
29 |
39 |
album_id INTEGER NOT NULL UNIQUE, |
| … | … | @@ -67,6 +77,12 @@ INSERT INTO favorite_albums (email, albu |
67 |
77 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 7, 4); |
68 |
78 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 4, 5); |
69 |
79 |
|
80 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 2, 1); |
|
81 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 1, 2); |
|
82 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 3, 3); |
|
83 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 7, 4); |
|
84 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 4, 5); |
|
85 |
||
70 |
86 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('john@smith.com', 2, 1); |
71 |
87 |
|
72 |
88 |
INSERT INTO events (title, start_date, end_date) VALUES ('First Event', '2008-01-01', '2008-01-01'); |
Up to file-list tests/database/setup-extended.oracle.sql:
| … | … | @@ -21,6 +21,15 @@ CREATE TABLE favorite_albums ( |
21 |
21 |
PRIMARY KEY (email, album_id) |
22 |
22 |
); |
23 |
23 |
|
24 |
CREATE TABLE year_favorite_albums ( |
|
25 |
email VARCHAR(200) NOT NULL REFERENCES users(email_address) ON DELETE CASCADE, |
|
26 |
year INTEGER NOT NULL, |
|
27 |
album_id INTEGER NOT NULL REFERENCES albums(album_id) ON DELETE CASCADE, |
|
28 |
position INTEGER NOT NULL, |
|
29 |
UNIQUE (email, year, position), |
|
30 |
PRIMARY KEY (email, year, album_id) |
|
31 |
); |
|
32 |
||
24 |
33 |
CREATE TABLE top_albums ( |
25 |
34 |
top_album_id INTEGER PRIMARY KEY, |
26 |
35 |
album_id INTEGER NOT NULL UNIQUE REFERENCES albums(album_id) ON DELETE CASCADE, |
| … | … | @@ -87,6 +96,12 @@ INSERT INTO favorite_albums (email, albu |
87 |
96 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 7, 4); |
88 |
97 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 4, 5); |
89 |
98 |
|
99 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 2, 1); |
|
100 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 1, 2); |
|
101 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 3, 3); |
|
102 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 7, 4); |
|
103 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 4, 5); |
|
104 |
||
90 |
105 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('john@smith.com', 2, 1); |
91 |
106 |
|
92 |
107 |
INSERT INTO events (title, start_date, end_date) VALUES ('First Event', '2008-01-01', '2008-01-01'); |
Up to file-list tests/database/setup-extended.postgresql.sql:
| … | … | @@ -21,6 +21,15 @@ CREATE TABLE favorite_albums ( |
21 |
21 |
PRIMARY KEY (email, album_id) |
22 |
22 |
); |
23 |
23 |
|
24 |
CREATE TABLE year_favorite_albums ( |
|
25 |
email VARCHAR(200) NOT NULL REFERENCES users(email_address) ON UPDATE CASCADE ON DELETE CASCADE, |
|
26 |
year INTEGER NOT NULL, |
|
27 |
album_id INTEGER NOT NULL REFERENCES albums(album_id) ON DELETE CASCADE, |
|
28 |
position INTEGER NOT NULL, |
|
29 |
UNIQUE (email, year, position), |
|
30 |
PRIMARY KEY (email, year, album_id) |
|
31 |
); |
|
32 |
||
24 |
33 |
CREATE TABLE top_albums ( |
25 |
34 |
top_album_id SERIAL PRIMARY KEY, |
26 |
35 |
album_id INTEGER NOT NULL UNIQUE REFERENCES albums(album_id) ON DELETE CASCADE, |
| … | … | @@ -63,6 +72,12 @@ INSERT INTO favorite_albums (email, albu |
63 |
72 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 7, 4); |
64 |
73 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 4, 5); |
65 |
74 |
|
75 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 2, 1); |
|
76 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 1, 2); |
|
77 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 3, 3); |
|
78 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 7, 4); |
|
79 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 4, 5); |
|
80 |
||
66 |
81 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('john@smith.com', 2, 1); |
67 |
82 |
|
68 |
83 |
INSERT INTO events (title, start_date, end_date) VALUES ('First Event', '2008-01-01', '2008-01-01'); |
Up to file-list tests/database/setup-extended.sqlite.sql:
| … | … | @@ -21,6 +21,15 @@ CREATE TABLE favorite_albums ( |
21 |
21 |
PRIMARY KEY (email, album_id) |
22 |
22 |
); |
23 |
23 |
|
24 |
CREATE TABLE year_favorite_albums ( |
|
25 |
email VARCHAR(200) NOT NULL REFERENCES users(email_address) ON UPDATE CASCADE ON DELETE CASCADE, |
|
26 |
year integer NOT NULL, |
|
27 |
album_id INTEGER NOT NULL REFERENCES albums(album_id) ON DELETE CASCADE, |
|
28 |
position INTEGER NOT NULL, |
|
29 |
UNIQUE (email, year, position), |
|
30 |
PRIMARY KEY (email, year, album_id) |
|
31 |
); |
|
32 |
||
24 |
33 |
CREATE TABLE top_albums ( |
25 |
34 |
top_album_id INTEGER PRIMARY KEY AUTOINCREMENT, |
26 |
35 |
album_id INTEGER NOT NULL UNIQUE REFERENCES albums(album_id) ON DELETE CASCADE, |
| … | … | @@ -63,6 +72,12 @@ INSERT INTO favorite_albums (email, albu |
63 |
72 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 7, 4); |
64 |
73 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('will@flourishlib.com', 4, 5); |
65 |
74 |
|
75 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 2, 1); |
|
76 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 1, 2); |
|
77 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 3, 3); |
|
78 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 7, 4); |
|
79 |
INSERT INTO year_favorite_albums (email, year, album_id, position) VALUES ('will@flourishlib.com', 2009, 4, 5); |
|
80 |
||
66 |
81 |
INSERT INTO favorite_albums (email, album_id, position) VALUES ('john@smith.com', 2, 1); |
67 |
82 |
|
68 |
83 |
INSERT INTO events (title, start_date, end_date) VALUES ('First Event', '2008-01-01', '2008-01-01'); |
Up to file-list tests/database/teardown-extended.mssql.sql:
1 |
1 |
DROP TABLE events; |
2 |
2 |
DROP TABLE invalid_tables; |
3 |
3 |
DROP TABLE top_albums; |
4 |
DROP TABLE year_favorite_albums; |
|
4 |
5 |
DROP TABLE favorite_albums; |
5 |
6 |
DROP TABLE record_deals; |
6 |
7 |
DROP TABLE record_labels; |
Up to file-list tests/database/teardown-extended.mysql.sql:
1 |
DROP TABLE IF EXISTS events, invalid_tables, top_albums, |
|
1 |
DROP TABLE IF EXISTS events, invalid_tables, top_albums, year_favorite_albums, favorite_albums, record_deals, record_labels, user_details; |
Up to file-list tests/database/teardown-extended.oracle.sql:
| … | … | @@ -3,6 +3,7 @@ DROP SEQUENCE events_event_id_seq; |
3 |
3 |
DROP TABLE invalid_tables PURGE; |
4 |
4 |
DROP TABLE top_albums PURGE; |
5 |
5 |
DROP SEQUENCE top_albums_top_album_id_seq; |
6 |
DROP TABLE year_favorite_albums PURGE; |
|
6 |
7 |
DROP TABLE favorite_albums PURGE; |
7 |
8 |
DROP TABLE record_deals PURGE; |
8 |
9 |
DROP TABLE record_labels PURGE; |
Up to file-list tests/database/teardown-extended.postgresql.sql:
1 |
1 |
DROP TABLE events; |
2 |
2 |
DROP TABLE invalid_tables; |
3 |
3 |
DROP TABLE top_albums; |
4 |
DROP TABLE year_favorite_albums; |
|
4 |
5 |
DROP TABLE favorite_albums; |
5 |
6 |
DROP TABLE record_deals; |
6 |
7 |
DROP TABLE record_labels; |
Up to file-list tests/database/teardown-extended.sqlite.sql:
