Bumping version to 0.07048_01
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / lib / make_dbictest_db_comments.pm
CommitLineData
5c06aa08 1package make_dbictest_db_comments;
2
3use strict;
4use warnings;
5use DBI;
6use dbixcsl_test_dir qw/$tdir/;
7
8eval { require DBD::SQLite };
9my $class = $@ ? 'SQLite2' : 'SQLite';
10
11my $fn = "$tdir/dbictest.db";
12
13unlink($fn);
14our $dsn = "dbi:$class:dbname=$fn";
15my $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 table_name TEXT,
22 comment_text TEXT
23 )|,
24 q|CREATE TABLE column_comments (
25 id INTEGER PRIMARY KEY,
26 table_name TEXT,
27 column_name TEXT,
28 comment_text TEXT
29 )|,
30 q|CREATE TABLE foo (
31 fooid INTEGER PRIMARY KEY,
32 footext TEXT DEFAULT 'footext',
33 foodt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
34 )|,
35 q|CREATE TABLE bar (
36 barid INTEGER PRIMARY KEY,
37 fooref INTEGER REFERENCES foo(fooid)
38 )|,
39 q|INSERT INTO table_comments (id, table_name, comment_text)
40 VALUES (1, 'foo', 'a short comment')
41 |,
42 q|INSERT INTO table_comments (id, table_name, comment_text)
43 VALUES (2, 'bar', 'a | . ('very ' x 80) . q|long comment')
44 |,
45 q|INSERT INTO column_comments (id, table_name, column_name, comment_text)
46 VALUES (1, 'foo', 'fooid', 'a short comment')
47 |,
48 q|INSERT INTO column_comments (id, table_name, column_name, comment_text)
49 VALUES (2, 'foo', 'footext', 'a | . ('very ' x 80) . q|long comment')
50 |,
51 q|INSERT INTO foo (fooid, footext) VALUES (1,'Foo text for number 1')|,
52 q|INSERT INTO foo (fooid, footext) VALUES (2,'Foo record associated with the Bar with barid 3')|,
53 q|INSERT INTO foo (fooid, footext) VALUES (3,'Foo text for number 3')|,
54 q|INSERT INTO foo (fooid, footext) VALUES (4,'Foo text for number 4')|,
55 q|INSERT INTO bar VALUES (1,4)|,
56 q|INSERT INTO bar VALUES (2,3)|,
57 q|INSERT INTO bar VALUES (3,2)|,
58 q|INSERT INTO bar VALUES (4,1)|,
59);
60
6d358d58 61END { unlink($fn) unless $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}; }
5c06aa08 62
631