Closed
Description
Description
migration to modify column to add unique_key on Postgres errors out with Execution Error: error returned from database: syntax error at or near "UNIQUE"
Steps to Reproduce
I setup migration like this:
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(User::Table)
.modify_column(ColumnDef::new(User::Email).string().not_null().unique_key())
.to_owned(),
)
.await
}
Expected Behavior
migration without error and unique constraint added in postgres,
Actual Behavior
Migration output:
Applying 1 pending migrations
Applying migration 'm20220925_053725_alter_email_to_unique'
Execution Error: error returned from database: syntax error at or near "UNIQUE"
Reproduces How Often
every time
Versions
❯ cargo tree | grep sea-
│ ├── sea-orm v0.9.2
│ │ ├── sea-orm-macros v0.9.2 (proc-macro)
│ │ ├── sea-query v0.26.3
│ │ │ ├── sea-query-derive v0.2.0 (proc-macro)
│ │ │ ├── sea-query-driver v0.2.2 (proc-macro)
│ │ ├── sea-strum v0.23.0
│ │ │ └── sea-strum_macros v0.23.0 (proc-macro)
│ └── sea-orm-migration v0.9.2
│ ├── sea-orm v0.9.2 (*)
│ ├── sea-orm-cli v0.9.2
│ │ ├── sea-schema v0.9.4
│ │ │ ├── sea-query v0.26.3 (*)
│ │ │ └── sea-schema-derive v0.1.0 (proc-macro)
│ ├── sea-schema v0.9.4 (*)
├── sea-orm v0.9.2 (*)
Mac OS BigSur 11.4
Postgres 14
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done