1 package make_dbictest_db_comments;
6 use dbixcsl_test_dir qw/$tdir/;
8 eval { require DBD::SQLite };
9 my $class = $@ ? 'SQLite2' : 'SQLite';
11 my $fn = "$tdir/dbictest.db";
14 our $dsn = "dbi:$class:dbname=$fn";
15 my $dbh = DBI->connect($dsn);
16 $dbh->do('PRAGMA SYNCHRONOUS = OFF');
19 q|CREATE TABLE table_comments (
20 id INTEGER PRIMARY KEY,
24 q|CREATE TABLE column_comments (
25 id INTEGER PRIMARY KEY,
31 fooid INTEGER PRIMARY KEY,
32 footext TEXT DEFAULT 'footext',
33 foodt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
36 barid INTEGER PRIMARY KEY,
37 fooref INTEGER REFERENCES foo(fooid)
39 q|INSERT INTO table_comments (id, table_name, comment_text)
40 VALUES (1, 'foo', 'a short comment')
42 q|INSERT INTO table_comments (id, table_name, comment_text)
43 VALUES (2, 'bar', 'a | . ('very ' x 80) . q|long comment')
45 q|INSERT INTO column_comments (id, table_name, column_name, comment_text)
46 VALUES (1, 'foo', 'fooid', 'a short comment')
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')
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)|,
61 END { unlink($fn) unless $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}; }