/[SQLSession]/trunk/lib/SQLSession/Bootstrap.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/SQLSession/Bootstrap.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 16 - (hide annotations)
Sun Dec 3 14:25:40 2006 UTC (17 years, 5 months ago) by dpavlin
File size: 765 byte(s)
fix bootstrap data generation
1 dpavlin 2 use warnings;
2     use strict;
3    
4     package SQLSession::Bootstrap;
5     use base qw(Jifty::Bootstrap);
6    
7     =head1 Bootstrap application data
8    
9     Create initial data
10    
11     =cut
12    
13     sub run {
14     my $self = shift;
15    
16     my $system_user = SQLSession::CurrentUser->superuser( _bootstrap => 1 );
17    
18     my $db = SQLSession::Model::Database->new(current_user => $system_user);
19     $db->create(
20     name => 'test',
21     dsn => 'DBI:Pg:dbname=test',
22     );
23    
24 dpavlin 15 my $q = SQLSession::Model::Query->new(current_user => $system_user);
25     $q->create(
26 dpavlin 4 name => 'test query',
27     sql_query => 'select * from a;',
28     on_database => $db,
29     );
30    
31 dpavlin 16 $db->create(
32     name => 'Pagila sample database',
33     dsn => 'DBI:Pg:dbname=pagila',
34     );
35    
36 dpavlin 15 $q->create(
37     name => 'All films',
38     sql_query => 'select * from film',
39 dpavlin 16 on_database => $db,
40 dpavlin 15 );
41    
42 dpavlin 2 }
43    
44     1;

  ViewVC Help
Powered by ViewVC 1.1.26