austgl / mysql-workbench-doctrine-plugin

Automatically exported from code.google.com/p/mysql-workbench-doctrine-plugin
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Doctrine does not like YEAR datatype #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Define a table in MySQL Workbench with a field declared as type YEAR
2. Export YAML

yearTable:
  tableName: year_table
  columns:
    year_table_id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    year_field:
      type: year
  options:
    type: MyISAM

3. Doctrine::generateModelsFromYaml('schema.yml', 'models');
4. Doctrine::createTablesFromModels('models');

What is the expected output? What do you see instead?

PHP Fatal error:  Uncaught exception 'Doctrine_Export_Exception' with
message 'While exporting model class 'yearTable' to SQL: Around field
year_field: Unknown field type 'year'.' in
C:\wamp\www\lib\Doctrine\Export.php:1263

What version of the product are you using? On what operating system?
0.3.6 on Windows 2K

Please provide any additional information below.

The easy fix is to use a SMALLINT datatype instead of YEAR and add
validation later.  However, since the plugin is doing some translation of
datatypes anyway, I thought you might want to think about making a
substitution for YEAR. 

Whatever you decide, thanks for publishing your script.

Original issue reported on code.google.com by michal.c...@gmail.com on 23 Aug 2009 at 7:09

GoogleCodeExporter commented 9 years ago
I understand what you mean, but i think it wouldn't be a good solution, to 
change the
type of YEAR to SMALLINT silently. Because for the database it's different.

Yes, you're right that we change some datatypes, expecially datetime to 
timestamp,
but we would avoid it if it wouldn't break the output completely.

For doctrine your "fix" might work well, because doctrine doesn't care about 
the date
stuff in the database - but if you handle with the database separately this can 
cause
problems.

I tink it isn't a big deal to solve this problem at user side and not on the 
plugins
side.

Thanks for your interest in our plugin and we hope you will not stop reporting 
bugs.

Original comment by johannes...@gmail.com on 24 Aug 2009 at 11:23

GoogleCodeExporter commented 9 years ago

Original comment by johannes...@gmail.com on 24 Aug 2009 at 5:16

GoogleCodeExporter commented 9 years ago
We have added this feature for 0.3.9.

Original comment by johannes...@gmail.com on 25 Oct 2009 at 7:33