1DBIx::Class::Admin(3) User Contributed Perl DocumentationDBIx::Class::Admin(3)
2
3
4

NAME

6       DBIx::Class::Admin - Administration object for schemas
7

SYNOPSIS

9         $ dbicadmin --help
10
11         $ dbicadmin --schema=MyApp::Schema \
12           --connect='["dbi:SQLite:my.db", "", ""]' \
13           --deploy
14
15         $ dbicadmin --schema=MyApp::Schema --class=Employee \
16           --connect='["dbi:SQLite:my.db", "", ""]' \
17           --op=update --set='{ "name": "New_Employee" }'
18
19         use DBIx::Class::Admin;
20
21         # ddl manipulation
22         my $admin = DBIx::Class::Admin->new(
23           schema_class=> 'MY::Schema',
24           sql_dir=> $sql_dir,
25           connect_info => { dsn => $dsn, user => $user, password => $pass },
26         );
27
28         # create SQLite sql
29         $admin->create('SQLite');
30
31         # create SQL diff for an upgrade
32         $admin->create('SQLite', {} , "1.0");
33
34         # upgrade a database
35         $admin->upgrade();
36
37         # install a version for an unversioned schema
38         $admin->install("3.0");
39

REQUIREMENTS

41       The Admin interface has additional requirements not currently part of
42       DBIx::Class. See DBIx::Class::Optional::Dependencies for more details.
43

ATTRIBUTES

45   schema_class
46       the class of the schema to load
47
48   schema
49       A pre-connected schema object can be provided for manipulation
50
51   resultset
52       a resultset from the schema to operate on
53
54   where
55       a hash ref or json string to be used for identifying data to manipulate
56
57   set
58       a hash ref or json string to be used for inserting or updating data
59
60   attrs
61       a hash ref or json string to be used for passing additonal info to the
62       ->search call
63
64   connect_info
65       connect_info the arguments to provide to the connect call of the
66       schema_class
67
68   config_file
69       config_file provide a config_file to read connect_info from, if this is
70       provided config_stanze should also be provided to locate where the
71       connect_info is in the config The config file should be in a format
72       readable by Config::General
73
74   config_stanza
75       config_stanza for use with config_file should be a '::' deliminated
76       'path' to the connection information designed for use with catalyst
77       config files
78
79   config
80       Instead of loading from a file the configuration can be provided
81       directly as a hash ref.  Please note config_stanza will still be
82       required.
83
84   sql_dir
85       The location where sql ddl files should be created or found for an
86       upgrade.
87
88   version
89       Used for install, the version which will be 'installed' in the schema
90
91   preversion
92       Previouse version of the schema to create an upgrade diff for, the full
93       sql for that version of the sql must be in the sql_dir
94
95   force
96       Try and force certain operations.
97
98   quiet
99       Be less verbose about actions
100

METHODS

102   create
103       Arguments: $sqlt_type, \%sqlt_args, $preversion
104
105       create will generate sql for the supplied schema_class in sql_dir.  The
106       flavour of sql to generate can be controlled by suppling a sqlt_type
107       which should be a SQL::Translator name.
108
109       Arguments for SQL::Translator can be supplied in the sqlt_args hashref.
110
111       Optional preversion can be supplied to generate a diff to be used by
112       upgrade.
113
114   upgrade
115       Arguments: <none>
116
117       upgrade will attempt to upgrade the connected database to the same
118       version as the schema_class.  MAKE SURE YOU BACKUP YOUR DB FIRST
119
120   install
121       Arguments: $version
122
123       install is here to help when you want to move to
124       DBIx::Class::Schema::Versioned and have an existing database.  install
125       will take a version and add the version tracking tables and 'install'
126       the version.  No further ddl modification takes place.  Setting the
127       force attribute to a true value will allow overriding of already
128       versioned databases.
129
130   deploy
131       Arguments: $args
132
133       deploy will create the schema at the connected database.  $args are
134       passed straight to "deploy" in DBIx::Class::Schema.
135
136   insert
137       Arguments: $rs, $set
138
139       insert takes the name of a resultset from the schema_class and a
140       hashref of data to insert into that resultset
141
142   update
143       Arguments: $rs, $set, $where
144
145       update takes the name of a resultset from the schema_class, a hashref
146       of data to update and a where hash used to form the search for the rows
147       to update.
148
149   delete
150       Arguments: $rs, $where, $attrs
151
152       delete takes the name of a resultset from the schema_class, a where
153       hashref and a attrs to pass to ->search.  The found data is deleted and
154       cannot be recovered.
155
156   select
157       Arguments: $rs, $where, $attrs
158
159       select takes the name of a resultset from the schema_class, a where
160       hashref and a attrs to pass to ->search.  The found data is returned in
161       a array ref where the first row will be the columns list.
162

AUTHOR

164       See "CONTRIBUTORS" in DBIx::Class.
165

LICENSE

167       You may distribute this code under the same terms as Perl itself
168
169
170
171perl v5.12.0                      2010-05-12             DBIx::Class::Admin(3)
Impressum