From: Gordon Irving Date: Tue, 28 Sep 2010 21:49:57 +0000 (+0100) Subject: inital start on sqlt_args support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fpeople%2Fgoraxe%2Fdbic_admin_sqlt_args;p=dbsrgits%2FDBIx-Class.git inital start on sqlt_args support --- diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm index c7640da..9c03011 100644 --- a/lib/DBIx/Class/Admin.pm +++ b/lib/DBIx/Class/Admin.pm @@ -243,6 +243,18 @@ has 'sql_type' => ( isa => Str, ); +=head2 sqlt_args + +Arguments that are passed to SQL::Translator when ever it is invoked + +=cut + +has 'sqlt_args' => ( + is => 'ro', + isa => DBICHashRef, +); + + =head2 version Used for install, the version which will be 'installed' in the schema @@ -339,6 +351,7 @@ sub create { $preversion ||= $self->preversion(); $sqlt_type ||= $self->sql_type(); + $sqlt_args ||= $self->sqlt_args(); my $schema = $self->schema(); # create the dir if does not exist diff --git a/script/dbicadmin b/script/dbicadmin index 16e97fe..db32c80 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -54,6 +54,7 @@ my ($opts, $usage) = describe_options( ['connect:s' => 'Supply the connect info as a json string' ], ['sql-dir:s' => 'The directory where sql diffs will be created'], ['sql-type:s' => 'The RDBMs flavour you wish to use'], + ['sqlt-args:s%' => 'Arguments to pass to SQL::Translate'], ['version:i' => 'Supply a version install'], ['preversion:s' => 'The previous version to diff against',], ['set:s' => 'JSON data used to perform data operations' ], diff --git a/t/admin/10script.t b/t/admin/10script.t index abcd2f9..5017d03 100644 --- a/t/admin/10script.t +++ b/t/admin/10script.t @@ -24,6 +24,7 @@ plan tests => ($tests_per_run * @json_backends) + 1; test_exec (qw| -It/lib/testinclude --schema=DBICTestAdminInc --insert --connect=[] |); cmp_ok ( $? >> 8, '==', 70, 'Correct exit code from connecting a custom INC schema' ); +# test json backends for my $js (@json_backends) { eval {JSON::Any->import ($js) }; @@ -36,6 +37,9 @@ for my $js (@json_backends) { } } +# test dbicadmin schema create +test_exec ( default_args(), qw|--create --sqlt-args add_drop_tables=1| ); + sub test_dbicadmin { my $schema = DBICTest->init_schema( sqlite_use_file => 1 ); # reinit a fresh db for every run