start of backcompat tests
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / make_dbictest_db2.pm
CommitLineData
66afce69 1package make_dbictest_db2;
2
3use strict;
4use warnings;
5use DBI;
6
7eval { require DBD::SQLite };
8my $class = $@ ? 'SQLite2' : 'SQLite';
9
10my $fn = './t/dbictest.db';
11
12unlink($fn);
13our $dsn = "dbi:$class:dbname=$fn";
14my $dbh = DBI->connect($dsn);
15
16$dbh->do($_) for (
17 q|CREATE TABLE foos (
18 fooid INTEGER PRIMARY KEY,
19 footext TEXT
20 )|,
21 q|CREATE TABLE bar (
22 barid INTEGER PRIMARY KEY,
23 fooref INTEGER REFERENCES foos (fooid)
24 )|,
25 q|CREATE TABLE bazes (
26 bazid INTEGER PRIMARY KEY,
27 baz_num INTEGER NOT NULL UNIQUE
28 )|,
29 q|CREATE TABLE quuxes (
30 quuxid INTEGER PRIMARY KEY,
31 bazref INTEGER NOT NULL,
32 FOREIGN KEY (bazref) REFERENCES bazes (baz_num)
33 )|,
34 q|INSERT INTO foos VALUES (1,'Foo text for number 1')|,
35 q|INSERT INTO foos VALUES (2,'Foo record associated with the Bar with barid 3')|,
36 q|INSERT INTO foos VALUES (3,'Foo text for number 3')|,
37 q|INSERT INTO foos 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 q|INSERT INTO bazes VALUES (1,20)|,
43 q|INSERT INTO bazes VALUES (2,19)|,
44 q|INSERT INTO quuxes VALUES (1,20)|,
45 q|INSERT INTO quuxes VALUES (2,19)|,
46);
47
48END { unlink($fn); }
49
501;