[DBIx-Class-Devel] [dbsrgits/sql-translator] Inconsistent behavior of MySQL producer with boolean columns (#81)

Fabrice Gabolde notifications at github.com
Wed Mar 30 15:37:45 GMT 2016


I'm adding a boolean column to an existing table and creating a different table with a boolean column:

```perl
    "flagged_for_deletion",
    {   data_type => "boolean",
        is_nullable => 0,
        default_value => 0,
    },
```

and generating the DDL via DBIx::Class:

```perl
$schema->create_ddl_dir( ['MySQL'], undef, './sql/ddl', $opt->pre_version,
                         { producer_args => { mysql_version => 5 } });
```

The full schema is correctly generated, both tables have "flagged_for_deletion boolean NOT NULL DEFAULT '0'" which is exactly what I expected.  The diff however:

```sql
CREATE TABLE `created` (
  -- snip
  `flagged_for_deletion` enum('0','1') NOT NULL DEFAULT '0',
  -- snip
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;

ALTER TABLE altered -- snip
                    ADD COLUMN flagged_for_deletion boolean NOT NULL DEFAULT '0',
                    -- snip
```

The CREATE TABLE statement has the backtick quoting (that the full schema doesn't have) and uses MySQL 3-style boolean emulation with enums.  From all the way over here it looks like it's been generated by a different producer with different options, so it might be a DBIC issue instead?


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/81
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20160330/68489c4a/attachment.htm>


More information about the DBIx-Class-Devel mailing list