generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When creating a table with an index that has a comment, the generated 'create index' SQL is invalid.
===Test
type IndexWithComment struct {
ID int
Name string gorm:"size:20;index:idx_name_cmt,unique,comment:index for user name"
}
DB.Migrator().DropTable(&IndexWithComment{})
if err := DB.AutoMigrate(&IndexWithComment{}); err != nil {
t.Fatalf("failed to migrate, got %v", err)
}
if !DB.Migrator().HasIndex(&IndexWithComment{}, "idx_name_cmt") {
t.Errorf("Failed to find created index")
}
===Generated SQL:
CREATE UNIQUE INDEX "idx_name_cmt" ON "index_with_comments"("name") COMMENT 'index for user name'
I think for 23ai, we should use ANNOTATIONS instead of COMMENT. And I think oracle doesn't support COMMENT ON index according to this doc:
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/COMMENT.html
Metadata
Metadata
Assignees
Labels
No labels