Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-18768

db_schema.dba should handle unsigned fields

    XMLWordPrintable

Details

    Description

      I have a mysql table, with some integer fields, and as I know the value will always be positive (think of an auto increment int id, primary key for example), I put this field as 'unsigned' in the mysql structure to use full range of the integer type (and not half of it)

      ezpublish also uses this logic in some core tables (in fact in very few tables at the moment), like in ezgeolocalization*, ezprest_clients

      Some extensions on share.ez.no uses also the unsigned attribute

      However, when I export the structure to a db_schema.dba, thanks to the command:

      $schema = eZDbSchema::instance();
      $schema->writeArraySchemaFile($output, array('schema'        => true,
                                                   'data'          => false,
                                                   'table_include' => array("ezprest_clients"),
                                                   'sort_columns'  => false, 'sort_indexes' => false));
      

      I get for the id field of ezprest_clients:

      $schema = array (
        'ezprest_clients' => 
        array (
          'name' => 'ezprest_clients',
          'fields' => 
          array (
            'id' => 
            array (
              'type' => 'auto_increment',
              'default' => false,
            ),
            'name' => 
            array (
              'length' => 100,
              'type' => 'varchar',
              'default' => NULL,
            ),
      [...]
      

      As a result, the unsigned attribute of id is lost in the db_schema.dba, so if import again in ez, the attribute won't be unsigned (information is lost)

      => So, to avoid loosing this attribute, the db_schema.dba should handle this. I guess the unsigned is supported by all sgbd on earth (specially postgresql, and oracle, other sgbd supported by ezpublish)

      Attachments

        Activity

          People

            unknown unknown
            enzo enzo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: