|
|
@ -55,8 +55,7 @@ public class SqlEntityDatabaseSchemaService extends SqlAbstractDatabaseSchemaSer |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void createCustomerTitleUniqueConstraintIfNotExists() { |
|
|
public void createCustomerTitleUniqueConstraintIfNotExists() { |
|
|
executeQuery("DO $$ BEGIN IF NOT EXISTS(SELECT FROM information_schema.constraint_column_usage " + |
|
|
executeQuery("DO $$ BEGIN IF NOT EXISTS(SELECT 1 FROM pg_constraint WHERE conname = 'customer_title_unq_key') THEN " + |
|
|
"WHERE table_name = 'customer' AND constraint_name = 'customer_title_unq_key') THEN " + |
|
|
"ALTER TABLE customer ADD CONSTRAINT customer_title_unq_key UNIQUE(tenant_id, title); END IF; END; $$;"); |
|
|
"ALTER TABLE customer ADD CONSTRAINT customer_title_unq_key UNIQUE (tenant_id, title); END IF; END $$;"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|