/[Frey]/trunk/lib/Strix/Schema.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/Strix/Schema.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 57 - (hide annotations)
Sun Jul 6 18:00:54 2008 UTC (15 years, 9 months ago) by dpavlin
File size: 848 byte(s)
fix Strix::User to return (some) rows
1 dpavlin 2 package Strix::Schema;
2    
3     use Fey::DBIManager;
4     use Fey::DBIManager::Source;
5     use Fey::Loader;
6     use Fey::ORM::Schema;
7    
8 dpavlin 15 use Storable;
9     use Data::Dump qw/dump/;
10 dpavlin 35 use URI::Escape;
11 dpavlin 15
12 dpavlin 35 my $dsn = 'dbi:Pg:dbname=new';
13 dpavlin 53 $dsn = 'dbi:SQLite:dbname=./var/strix.sqlite';
14 dpavlin 15
15 dpavlin 35 my $schema_file = 'var/schema.' . uri_escape( $dsn );
16 dpavlin 2
17 dpavlin 35 warn "Database $dsn schema cache $schema_file\n";
18    
19     my $source = Fey::DBIManager::Source->new( dsn => $dsn );
20    
21 dpavlin 15 my $schema;
22 dpavlin 53 if ( 0 ) { # FIXME
23     #if ( -e $schema_file ) {
24 dpavlin 15 $schema = retrieve $schema_file or die "can't read schema from $schema_file: $!";
25     } else {
26 dpavlin 53 $schema = Fey::Loader->new( dbh => $source->dbh() )->make_schema();
27 dpavlin 57 # store $schema, $schema_file or warn "can't store schema into $schema_file: $!";
28 dpavlin 15 }
29 dpavlin 2
30     has_schema $schema;
31    
32 dpavlin 57 warn Strix::Schema->SQLFactoryClass();
33    
34 dpavlin 2 __PACKAGE__->DBIManager()->add_source($source);
35 dpavlin 55
36     warn "loaded.";
37    
38     1;

  ViewVC Help
Powered by ViewVC 1.1.26