Added InflateColumn::DateTime component
[dbsrgits/DBIx-Class-Historic.git] / t / lib / DBICTest / Setup.pm
CommitLineData
4d9d84d5 1use strict;
2use warnings;
1c339d71 3use DBICTest;
4d9d84d5 4
1c339d71 5my $schema = DBICTest->initialise;
4d9d84d5 6
a37a4697 7$schema->storage->on_connect_do([ "PRAGMA synchronous = OFF" ]);
4d9d84d5 8
a37a4697 9my $dbh = $schema->storage->dbh;
4d9d84d5 10
1c339d71 11if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
12 $schema->deploy;
13} else {
14 open IN, "t/lib/sqlite.sql";
0009fa49 15
1c339d71 16 my $sql;
a37a4697 17
1c339d71 18 { local $/ = undef; $sql = <IN>; }
0009fa49 19
1c339d71 20 close IN;
0009fa49 21
38e48163 22 $dbh->do($_) for split(/;\n/, $sql);
1c339d71 23}
4d9d84d5 24
25$schema->storage->dbh->do("PRAGMA synchronous = OFF");
26
a37a4697 27$schema->populate('Artist', [
28 [ qw/artistid name/ ],
29 [ 1, 'Caterwauler McCrae' ],
30 [ 2, 'Random Boy Band' ],
31 [ 3, 'We Are Goth' ],
32]);
33
34$schema->populate('CD', [
35 [ qw/cdid artist title year/ ],
36 [ 1, 1, "Spoonful of bees", 1999 ],
37 [ 2, 1, "Forkful of bees", 2001 ],
38 [ 3, 1, "Caterwaulin' Blues", 1997 ],
39 [ 4, 2, "Generic Manufactured Singles", 2001 ],
40 [ 5, 3, "Come Be Depressed With Us", 1998 ],
41]);
42
43$schema->populate('LinerNotes', [
44 [ qw/liner_id notes/ ],
45 [ 2, "Buy Whiskey!" ],
46 [ 4, "Buy Merch!" ],
47 [ 5, "Kill Yourself!" ],
48]);
49
50$schema->populate('Tag', [
51 [ qw/tagid cd tag/ ],
52 [ 1, 1, "Blue" ],
53 [ 2, 2, "Blue" ],
54 [ 3, 3, "Blue" ],
55 [ 4, 5, "Blue" ],
56 [ 5, 2, "Cheesy" ],
57 [ 6, 4, "Cheesy" ],
58 [ 7, 5, "Cheesy" ],
59 [ 8, 2, "Shiny" ],
60 [ 9, 4, "Shiny" ],
61]);
62
63$schema->populate('TwoKeys', [
64 [ qw/artist cd/ ],
65 [ 1, 1 ],
66 [ 1, 2 ],
67 [ 2, 2 ],
68]);
69
70$schema->populate('FourKeys', [
71 [ qw/foo bar hello goodbye/ ],
72 [ 1, 2, 3, 4 ],
73 [ 5, 4, 3, 6 ],
74]);
75
76$schema->populate('OneKey', [
77 [ qw/id artist cd/ ],
78 [ 1, 1, 1 ],
79 [ 2, 1, 2 ],
80 [ 3, 2, 2 ],
81]);
82
83$schema->populate('SelfRef', [
84 [ qw/id name/ ],
85 [ 1, 'First' ],
86 [ 2, 'Second' ],
87]);
88
89$schema->populate('SelfRefAlias', [
90 [ qw/self_ref alias/ ],
91 [ 1, 2 ]
92]);
93
94$schema->populate('ArtistUndirectedMap', [
95 [ qw/id1 id2/ ],
96 [ 1, 2 ]
97]);
98
99$schema->populate('Producer', [
100 [ qw/producerid name/ ],
101 [ 1, 'Matt S Trout' ],
0f6ac8bb 102 [ 2, 'Bob The Builder' ],
103 [ 3, 'Fred The Phenotype' ],
a37a4697 104]);
105
106$schema->populate('CD_to_Producer', [
107 [ qw/cd producer/ ],
108 [ 1, 1 ],
0f6ac8bb 109 [ 1, 2 ],
110 [ 1, 3 ],
a37a4697 111]);
0009fa49 112
887ce227 113$schema->populate('TreeLike', [
114 [ qw/id parent name/ ],
115 [ 1, 0, 'foo' ],
116 [ 2, 1, 'bar' ],
117 [ 3, 2, 'baz' ],
118 [ 4, 3, 'quux' ],
119]);
120
b8d4bd90 121$schema->populate('Track', [
122 [ qw/trackid cd position title/ ],
123 [ 4, 2, 1, "Stung with Success"],
124 [ 5, 2, 2, "Stripy"],
125 [ 6, 2, 3, "Sticky Honey"],
126 [ 7, 3, 1, "Yowlin"],
127 [ 8, 3, 2, "Howlin"],
128 [ 9, 3, 3, "Fowlin"],
129 [ 10, 4, 1, "Boring Name"],
130 [ 11, 4, 2, "Boring Song"],
131 [ 12, 4, 3, "No More Ideas"],
132 [ 13, 5, 1, "Sad"],
133 [ 14, 5, 2, "Under The Weather"],
134 [ 15, 5, 3, "Suicidal"],
135 [ 16, 1, 1, "The Bees Knees"],
136 [ 17, 1, 2, "Apiary"],
137 [ 18, 1, 3, "Beehind You"],
138]);
139
f86fcf0d 140$schema->populate('Event', [
141 [ qw/id starts_at/ ],
142 [ 1, '2006-04-25 22:24:33' ],
143]);
144
a37a4697 1451;