/[Frey]/trunk/lib/Reblog/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

Contents of /trunk/lib/Reblog/Schema.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 621 - (show annotations)
Sat Nov 29 16:41:24 2008 UTC (14 years, 2 months ago) by dpavlin
File size: 656 byte(s)
 r702@eeepy:  dpavlin | 2008-11-29 17:41:26 +0100
 configure all dsn setting in config file

1 package Reblog::Schema;
2
3 use Fey::ORM::Schema;
4
5 my $dsn = __PACKAGE__->config( __PACKAGE__ )->{dsn}; # FIXME yaaaack
6 my $dsn = "DBI:mysql:database=reblog";
7 $dsn .= ";host=127.0.0.1;port=13306"; # XXX over ssh
8
9 my ( $schema, $source ) = Frey::Schema->schema_source( $dsn );
10
11 has_schema $schema;
12
13 # fixup MySQL schema (hooray!)
14
15 $schema->add_foreign_key(
16 Fey::FK->new(
17 source_columns => [ $schema->table('feeds')->column('id') ],
18 target_columns => [ $schema->table('items')->column('feed_id') ],
19 )
20 );
21
22 __PACKAGE__->DBIManager()->add_source($source);
23
24 #$source->dbh->do( qq{ set client_encoding = 'utf-8' } ) if $dsn =~ /Pg/;
25
26 warn "## dsn $dsn";
27
28 1;

  ViewVC Help
Powered by ViewVC 1.1.26