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