On 6 Jun 2008, at 15:36, Juan Camacho wrote:

I would really like to use the new schema version functionality, but
ran into a problem when the schema is generated for MySQL.  The
generated SQL contain CONSTRAINT clauses that cause an error.  Is
there a way to completely disable them?

$schema->create_ddl_dir(['MySQL'], '1.1', './sql', 0, {producer_args
=> {mysql_table_type => 'MyISAM'}});

For example:

CREATE TABLE `attendee` (
 `attendee_id` integer(10) NOT NULL,
 `company_id` integer(10) NOT NULL DEFAULT '0',
 `name` VARCHAR(255) NOT NULL DEFAULT '',
 `first` VARCHAR(100),
 `last` VARCHAR(100),
 `title` VARCHAR(100),
 `bank_rep` integer(10) DEFAULT '0',
 `email` VARCHAR(100),
 `foreign_id` VARCHAR(32),
 INDEX attendee_idx_company_id (`company_id`),
 PRIMARY KEY (`attendee_id`),
 UNIQUE `name_company_idx` (`company_id`, `name`),
 CONSTRAINT `attendee_fk_company_id` FOREIGN KEY (`company_id`)
REFERENCES `company` (`company_id`) ON DELETE CASCADE ON UPDATE CAS
CADE
) ENGINE=InnoDB;

FYI, I'm using the development release (0.08099_02) that's on CPAN,
since I realized that the regular release doesn't pass arguments
forward.


What error is it giving? What version of MySQL (server) are you using?

That isn't where mysql_table_type goes - you want something like this in your Schema.pm file (assuming you got the extra key right - i didn't check)

sub sqlt_deploy_hook {
  my ($self, $sqlt_schema) = @_;

  for my $table ($sqlt_schema->get_tables) {
    $table->extra(
      mysql_table_type => 'MyISAM',
    );
  }
}

HTH
-ash


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to