Doctrine 1
  1. Doctrine 1
  2. DC-569

Duplicate unique indexes on PostgreSQL

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: Cli, Native SQL
    • Labels:
      None
    • Environment:
      Window, Ubuntu, PostgreSQL 8.3, PHP 5.3

      Description

      Generated by doctrine-cli SQL is:

      – this is ok
      CREATE TABLE "image" ("id" BIGSERIAL, "alt" VARCHAR(255), "title" VARCHAR(500), "filename" VARCHAR(255), "width" BIGINT, "height" BIGINT, "slug" VARCHAR(255), "createdat" TIMESTAMP NOT NULL, "updatedat" TIMESTAMP NOT NULL, PRIMARY KEY("id"));
      CREATE TABLE "news" ("id" BIGSERIAL, "title" VARCHAR(255), "leadmarkup" VARCHAR(500), "leadhtml" VARCHAR(600), "bodymarkup" TEXT, "bodyhtml" TEXT, "slug" VARCHAR(255), "createdat" TIMESTAMP NOT NULL, "updatedat" TIMESTAMP NOT NULL, PRIMARY KEY("id"));
      CREATE TABLE "snippet" ("id" BIGSERIAL, "name" VARCHAR(255), "bodymarkup" TEXT, "bodyhtml" TEXT, "slug" VARCHAR(255), "createdat" TIMESTAMP NOT NULL, "updatedat" TIMESTAMP NOT NULL, PRIMARY KEY("id"));
      – this causes error
      CREATE UNIQUE INDEX "sluggable" ON "image" ("slug");
      CREATE UNIQUE INDEX "sluggable" ON "news" ("slug");
      CREATE UNIQUE INDEX "sluggable" ON "snippet" ("slug");

      After importing this to PostgreSQL, I get 'index already exists' error.

      On PostgreSQL unique indexes names must not be the same.
      I think the correct form should be:
      CREATE UNIQUE INDEX "sluggable-image" ON "image" ("slug");
      CREATE UNIQUE INDEX "sluggable-news" ON "news" ("slug");
      CREATE UNIQUE INDEX "sluggable-snippet" ON "snippet" ("slug");

      Schema file attached.

        Activity

        Hide
        Jonathan H. Wage added a comment -
        Show
        Jonathan H. Wage added a comment - This was fixed here http://trac.doctrine-project.org/changeset/7372

          People

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

            Dates

            • Created:
              Updated:
              Resolved: