#2396 new
elitalon

Support for unsigned integer in MySQL

Reported by elitalon | December 19th, 2011 @ 05:58 AM | in Future

Is there any reason why there is no support in CakeSchema for the unsigned integer data type?

I tried to create a table with a foreign key of unsigned integer but it could not be created because the referenced column was created integer (using CakeDC's Migrations plugin, btw).

If not, do you think it's worth to contribute with that?

Comments and changes to this ticket

  • euromark

    euromark December 19th, 2011 @ 06:11 AM

    I second this.
    The 2.0 schema already supports the full range of attributes now (including comments) which is great.
    adding support for unsigned would make it complete.

    I got a 2.0 schema here for reference:

    public $meals = array(
        'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary', 'collate' => NULL, 'comment' => ''),
        'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 60, 'collate' => 'utf8_unicode_ci', 'comment' => '', 'charset' => 'utf8'),
        'is_master' => array('type' => 'boolean', 'null' => false, 'default' => NULL, 'collate' => NULL, 'comment' => ''),
        'type' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 2, 'collate' => NULL, 'comment' => 'economy, premium'),
        'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
        'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'MyISAM')
    );
    

    "id", "type" and "is_master" are unsigned in the DB - but do not show. Additionally, boolean fields like "is_master" here could be made unsigned by default (no need for negative values ever).

  • ADmad

    ADmad December 19th, 2011 @ 06:22 AM

    • → Tag changed from datatypes, enhancement, mysql, unsigned to cakeschema, datatypes, enhancement, mysql, unsigned
    • → Milestone set to Future

    Enhancement patches for 2.1 are welcome.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Source available from github

Repository is at http://github.com/cakephp/cakephp

Creating a bug report

When creating a bug report, please include as much relevant information as possible. Please include code to reproduce the issue. Or even better, make a unit test. Either change an existing test or add a new test to show that the expected behavior is not occuring.

People watching this ticket