Skip to content

Commit fb51ce1

Browse files
committed
fix: prevent duplicate index creation error in PostgreSQL
1 parent 634e6df commit fb51ce1

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

adapter.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ func (the *CasbinRule) TableName() string {
3737

3838
// CasbinRule .
3939
type CasbinRule struct {
40-
Ptype string `xorm:"varchar(100) index not null default ''"`
41-
V0 string `xorm:"varchar(100) index not null default ''"`
42-
V1 string `xorm:"varchar(100) index not null default ''"`
43-
V2 string `xorm:"varchar(100) index not null default ''"`
44-
V3 string `xorm:"varchar(100) index not null default ''"`
45-
V4 string `xorm:"varchar(100) index not null default ''"`
46-
V5 string `xorm:"varchar(100) index not null default ''"`
40+
Ptype string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
41+
V0 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
42+
V1 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
43+
V2 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
44+
V3 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
45+
V4 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
46+
V5 string `xorm:"varchar(100) index(IF NOT EXISTS) not null default ''"`
4747

4848
tableName string `xorm:"-"`
4949
}

0 commit comments

Comments
 (0)