Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Fix UNIQUE not added in postgres

1ilit219a5a877bf7
diff --git a/src/utils/toSQL.js b/src/utils/toSQL.js
index 0625b93e..9f1fa30e 100644
--- a/src/utils/toSQL.js
+++ b/src/utils/toSQL.js
@@ -265,7 +265,7 @@ export function jsonToPostgreSQL(obj) {
field.name
}" ${getTypeString(field, "postgres")}${
field.notNull ? " NOT NULL" : ""
- }${
+ }${field.unique ? " UNIQUE" : ""}${
field.default !== "" ? ` DEFAULT ${parseDefault(field)}` : ""
}${
field.check === "" || !hasCheck(field.type)