Doctrine 1
  1. Doctrine 1
  2. DC-782

Generated SQL for indexes is faulty

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      LAMP, PHP 5.2.6, PostgreSQL 8.3

      Description

      We have the following YAML:

      Yaml
      User:
        columns:
          id:
            type: integer
            unsigned: 1
            primary: true
            autoincrement: true
          username: 
            type: string(255)
            notnull: true
        indexes:
          username_index:
            fields:
              username:
                type: unique
      

      The resulting record-class looks like this, which is still fine:

      Class
      class User extends Doctrine_Record
      {
          public function setTableDefinition()
          {
              $this->setTableName('users');
              $this->hasColumn('id', 'integer', null, array(
                   'type' => 'integer',
                   'unsigned' => 1,
                   'primary' => true,
                   'autoincrement' => true,
                   ));
              $this->hasColumn('username', 'string', 255, array(
                   'type' => 'string',
                   'notnull' => true,
                   'length' => '255',
                   ));
       
      
              $this->index('username_index', array(
                   'fields' => 
                   array(
                    'username' => 
                    array(
                    'type' => 'unique',
                    ),
                   ),
                   ));
          }
      
          public function setUp()
          {
              parent::setUp();
          }
      }
      

      But the resulting SQL looks like this, which is faulty because of the Array stuff at the index:

      SQL
      CREATE TABLE "users" ("id" BIGSERIAL, "username" VARCHAR(255) NOT NULL, PRIMARY KEY("id"));
      CREATE INDEX "username_index" ON "users" ("Array");
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Christian Schmitz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: