Commit | Line | Data |
5c06aa08 |
1 | package make_dbictest_db_bad_comment_tables; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use DBI; |
6 | use dbixcsl_test_dir qw/$tdir/; |
7 | |
8 | eval { require DBD::SQLite }; |
9 | my $class = $@ ? 'SQLite2' : 'SQLite'; |
10 | |
11 | my $fn = "$tdir/dbictest.db"; |
12 | |
13 | unlink($fn); |
14 | our $dsn = "dbi:$class:dbname=$fn"; |
15 | my $dbh = DBI->connect($dsn); |
16 | $dbh->do('PRAGMA SYNCHRONOUS = OFF'); |
17 | |
18 | $dbh->do($_) for ( |
19 | q|CREATE TABLE table_comments( |
20 | id INTEGER PRIMARY KEY |
21 | )|, |
22 | q|CREATE TABLE column_comments( |
23 | id INTEGER PRIMARY KEY |
24 | )|, |
25 | q|CREATE TABLE foo ( |
26 | fooid INTEGER PRIMARY KEY, |
27 | footext TEXT DEFAULT 'footext', |
28 | foodt TIMESTAMP DEFAULT CURRENT_TIMESTAMP |
29 | )|, |
30 | q|CREATE TABLE bar ( |
31 | barid INTEGER PRIMARY KEY, |
32 | fooref INTEGER REFERENCES foo(fooid) |
33 | )|, |
34 | q|INSERT INTO foo (fooid, footext) VALUES (1,'Foo text for number 1')|, |
35 | q|INSERT INTO foo (fooid, footext) VALUES (2,'Foo record associated with the Bar with barid 3')|, |
36 | q|INSERT INTO foo (fooid, footext) VALUES (3,'Foo text for number 3')|, |
37 | q|INSERT INTO foo (fooid, footext) VALUES (4,'Foo text for number 4')|, |
38 | q|INSERT INTO bar VALUES (1,4)|, |
39 | q|INSERT INTO bar VALUES (2,3)|, |
40 | q|INSERT INTO bar VALUES (3,2)|, |
41 | q|INSERT INTO bar VALUES (4,1)|, |
42 | ); |
43 | |
44 | END { unlink($fn); } |
45 | |
46 | 1 |