|
NAMEDBIx::Class::Admin - Administration object for schemasSYNOPSIS$ dbicadmin --help $ dbicadmin --schema=MyApp::Schema \ --connect='["dbi:SQLite:my.db", "", ""]' \ --deploy $ dbicadmin --schema=MyApp::Schema --class=Employee \ --connect='["dbi:SQLite:my.db", "", ""]' \ --op=update --set='{ "name": "New_Employee" }' use DBIx::Class::Admin; # ddl manipulation my $admin = DBIx::Class::Admin->new( schema_class=> 'MY::Schema', sql_dir=> $sql_dir, connect_info => { dsn => $dsn, user => $user, password => $pass }, ); # create SQLite sql $admin->create('SQLite'); # create SQL diff for an upgrade $admin->create('SQLite', {} , "1.0"); # upgrade a database $admin->upgrade(); # install a version for an unversioned schema $admin->install("3.0"); REQUIREMENTSThe Admin interface has additional requirements not currently part of DBIx::Class. See DBIx::Class::Optional::Dependencies for more details.ATTRIBUTESschema_classthe class of the schema to loadschemaA pre-connected schema object can be provided for manipulationresultseta resultset from the schema to operate onwherea hash ref or json string to be used for identifying data to manipulateseta hash ref or json string to be used for inserting or updating dataattrsa hash ref or json string to be used for passing additional info to the ->search callconnect_infoconnect_info the arguments to provide to the connect call of the schema_classconfig_fileconfig_file provide a config_file to read connect_info from, if this is provided config_stanze should also be provided to locate where the connect_info is in the config The config file should be in a format readable by Config::Any.config_stanzaconfig_stanza for use with config_file should be a '::' delimited 'path' to the connection information designed for use with catalyst config filesconfigInstead of loading from a file the configuration can be provided directly as a hash ref. Please note config_stanza will still be required.sql_dirThe location where sql ddl files should be created or found for an upgrade.sql_typeThe type of sql dialect to use for creating sql files from schemaversionUsed for install, the version which will be 'installed' in the schemapreversionPrevious version of the schema to create an upgrade diff for, the full sql for that version of the sql must be in the sql_dirforceTry and force certain operations.quietBe less verbose about actionstraceToggle DBIx::Class debug outputMETHODScreate
"create" will generate sql for the supplied schema_class in sql_dir. The flavour of sql to generate can be controlled by supplying a sqlt_type which should be a SQL::Translator name. Arguments for SQL::Translator can be supplied in the sqlt_args hashref. Optional preversion can be supplied to generate a diff to be used by upgrade. upgrade
upgrade will attempt to upgrade the connected database to the same version as the schema_class. MAKE SURE YOU BACKUP YOUR DB FIRST install
install is here to help when you want to move to DBIx::Class::Schema::Versioned and have an existing database. install will take a version and add the version tracking tables and 'install' the version. No further ddl modification takes place. Setting the force attribute to a true value will allow overriding of already versioned databases. deploy
deploy will create the schema at the connected database. $args are passed straight to "deploy" in DBIx::Class::Schema. insert
insert takes the name of a resultset from the schema_class and a hashref of data to insert into that resultset update
update takes the name of a resultset from the schema_class, a hashref of data to update and a where hash used to form the search for the rows to update. delete
delete takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is deleted and cannot be recovered. select
select takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is returned in a array ref where the first row will be the columns list. FURTHER QUESTIONS?Check the list of additional DBIC resources.COPYRIGHT AND LICENSEThis module is free software copyright by the DBIx::Class (DBIC) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.
Visit the GSP FreeBSD Man Page Interface. |