-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
79 lines (63 loc) · 2.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
NAME
Catalyst::TraitFor::Model::DBIC::Schema::ConnectInfo::Several - support
for several "connect_info" entries.
VERSION
Version is 0.06
SYNOPSIS
package MyApp::Model::DB;
use Moose;
use namespace::autoclean;
extends 'Catalyst::Model::DBIC::Schema';
__PACKAGE__->config(
{
traits => ['ConnectInfo::Several'],
schema_class => 'MyApp::Schema',
active_connection => 'mysql_devel',
connections => {
mysql_devel => [ 'dbi:mysql:db_devel', 'user1', 'pass1' ],
mysql_production => [ 'dbi:mysql:db_prod', 'user2', 'pass2' ],
},
}
);
#
# or in application config
#
<Model::DB>
traits ConnectInfo::Several
active_connection mysql_devel
<connections>
<mysql_devel>
dns dbi:mysql:db_devel
user user1
password pass1
</mysql_devel>
<mysql_prod>
dns dbi:mysql:db_prod
user user2
password pass2
</mysql_prod>
</connections>
</Model::DB>
DESCRIPTION
You can define several connections in "connections" hash, and select
which one should be used currently via "active_connection". You
shouldn't define "connect_info" - it will be set for you, depending on
what you set in "active_connection" and "connections".
This trait will do something only if you set "active_connection",
otherwise it just do nothing, like it was not used at all.
TODO
Write tests.
GIT REPOSITORY
git clone git://github.com/cub-uanic/Catalyst-TraitFor-Model-DBIC-Schema-ConnectInfo-Several.git
SEE ALSO
Catalyst::Model::DBIC::Schema, DBIx::Class, Catalyst
AUTHOR
Oleg Kostyuk, "<cub#cpan.org>"
ACKNOWLEDGEMENTS
Matt S. Trout "<mst#shadowcatsystems.co.uk>"
COPYRIGHT & LICENSE
Copyright by Oleg Kostyuk.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.