Script generation (Export) needs work

When you ‘export’ the schema to an RDBMS by creating a script, the unique index names are not unique because it just uses the name of the field. Instead, it should use [TableName]_[FieldName]. Here’s an example of the issue when I Exported to PostgreSQL:

CREATE UNIQUE INDEX “Name” ON “InstitutionType” (“Name”);
CREATE UNIQUE INDEX “Name” ON “Institution” (“Name”);
CREATE UNIQUE INDEX “InstitutionTypeId_Name” ON “Institution” (“InstitutionTypeId”, “Name”);
CREATE UNIQUE INDEX “Name” ON “SchoolType” (“Name”);
CREATE UNIQUE INDEX “Name” ON “School” (“Name”);

Resulting in error…

ERROR: relation “Name” already exists
SQL state: 42P07

Hi Larry,

Currently, when exported to PostgreSQL we will use the name setting defined in dbml or leave it empty when undefined.

If your index definition doesn’t have a name and is still exported with one, please help provide the original dbml that caused the problem so that we investigate further.

Thanks.