data type tester for common tests
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / make_dbictest_db.pm
CommitLineData
996be9ee 1package make_dbictest_db;
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);
fa994d3c 13our $dsn = "dbi:$class:dbname=$fn";
14my $dbh = DBI->connect($dsn);
996be9ee 15
16$dbh->do($_) for (
17 q|CREATE TABLE foo (
18 fooid INTEGER PRIMARY KEY,
f170d55b 19 footext TEXT DEFAULT 'footext',
20 foodt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
996be9ee 21 )|,
22 q|CREATE TABLE bar (
23 barid INTEGER PRIMARY KEY,
24 fooref INTEGER REFERENCES foo(fooid)
25 )|,
f170d55b 26 q|INSERT INTO foo (fooid, footext) VALUES (1,'Foo text for number 1')|,
27 q|INSERT INTO foo (fooid, footext) VALUES (2,'Foo record associated with the Bar with barid 3')|,
28 q|INSERT INTO foo (fooid, footext) VALUES (3,'Foo text for number 3')|,
29 q|INSERT INTO foo (fooid, footext) VALUES (4,'Foo text for number 4')|,
996be9ee 30 q|INSERT INTO bar VALUES (1,4)|,
31 q|INSERT INTO bar VALUES (2,3)|,
32 q|INSERT INTO bar VALUES (3,2)|,
33 q|INSERT INTO bar VALUES (4,1)|,
34);
35
36END { unlink($fn); }
37
381;