Tuesday, March 25, 2014

Re: Console/cake schema pitfalls ?

Have you considered using the Migrations plugin from CakeDC? https://github.com/CakeDC/migrations It handles the actual changes, rather than having a 'full' copy as schemas do. 

I think the issue you are seeing is more about the datasource definition, as that is where it gives the datatype to general type definitions ... for example:

public $columns = array(
'primary_key' => array('name' => 'IDENTITY (1, 1) NOT NULL'),
'string' => array('name' => 'varchar', 'limit' => '255'),
'text' => array('name' => 'text'),
'integer' => array('name' => 'int', 'formatter' => 'intval'),
'float' => array('name' => 'numeric', 'formatter' => 'floatval'),
'datetime' => array('name' => 'datetime', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
'time' => array('name' => 'datetime', 'format' => 'H:i:s', 'formatter' => 'date'),
'date' => array('name' => 'datetime', 'format' => 'Y-m-d', 'formatter' => 'date'),
'binary' => array('name' => 'image'),
'boolean' => array('name' => 'bit')
);

That is from the sqlsrv.php datasource, so it really only uses those and then converts back and forth. This allows you to write your migration / schema in mysql, but I can instantiate it in mssql. If you start messing with this, it could be more problematic!

Thanks,
Vincent

On Monday, March 24, 2014 8:28:30 AM UTC-4, Thomas von Hassel wrote:
Last time i tried to use Console/cake schema (early days 2.x) to mange my databases and their changes, there were some issues with field types. (i'm sorry but i forgot what exactly was the problem)

Are there any pitfalls today ? ... and is this functionality going to make it into 3.0 ?

/thomas

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: