X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=DBSchema%2FTable.pm;h=6463ee016429e9044e1be99eb64319ea2e616636;hb=7a15dfc7862428fb4c543698bf981231ca8f2983;hp=16ba3a0ac507e5e2e7c8f5d16ffb5b6740de170c;hpb=455adacf257c5d443dd9b1917c329983990c1e78;p=DBIx-DBSchema.git diff --git a/DBSchema/Table.pm b/DBSchema/Table.pm index 16ba3a0..6463ee0 100644 --- a/DBSchema/Table.pm +++ b/DBSchema/Table.pm @@ -10,7 +10,7 @@ use DBIx::DBSchema::Index; use DBIx::DBSchema::ColGroup::Unique; use DBIx::DBSchema::ColGroup::Index; -$VERSION = '0.05'; +$VERSION = '0.06'; $DEBUG = 0; =head1 NAME @@ -87,10 +87,11 @@ Creates a new DBIx::DBSchema::Table object. The preferred usage is to pass a hash reference of named parameters. { - name => TABLE_NAME, - primary_key => PRIMARY_KEY, - columns => COLUMNS, - indices => INDICES, + name => TABLE_NAME, + primary_key => PRIMARY_KEY, + columns => COLUMNS, + indices => INDICES, + local_options => OPTIONS, #deprecated# unique => UNIQUE, #deprecated# index => INDEX, } @@ -100,6 +101,8 @@ empty). COLUMNS is a reference to an array of DBIx::DBSchema::Column objects (see L). INDICES is a reference to an array of DBIx::DBSchema::Index objects (see L), or a hash reference of index names (keys) and DBIx::DBSchema::Index objects (values). +OPTIONS is a scalar of database-specific table options, such as "WITHOUT OIDS" +for Pg or "TYPE=InnoDB" for mysql. Deprecated options: @@ -346,6 +349,21 @@ sub name { } } +=item local_options [ OPTIONS ] + +Returns or sets the database-specific table options string. + +=cut + +sub local_options { + my($self,$value)=@_; + if ( defined($value) ) { + $self->{local_options} = $value; + } else { + $self->{local_options}; + } +} + =item primary_key [ PRIMARY_KEY ] Returns or sets the primary key. @@ -531,7 +549,8 @@ sub sql_create_table { my $indexnum = 1; my @r = ( - "CREATE TABLE ". $self->name. " (\n ". join(",\n ", @columns). "\n)\n" + "CREATE TABLE ". $self->name. " (\n ". join(",\n ", @columns). "\n)\n". + $self->local_options ); if ( $self->_unique ) {