Skip to content

Commit ca10118

Browse files
authored
feat: fix duplicated index creation bug in PostgreSQL (#68)
1 parent 634e6df commit ca10118

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929

3030
steps:
3131
- name: Set up Go
32-
uses: actions/setup-go@v2
32+
uses: actions/setup-go@v4
3333
with:
34-
go-version: 1.19
34+
go-version: 1.21
3535

36-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v4
3737
- name: Run Unit tests
3838
run: go test -v -coverprofile=profile.cov ./...
3939

@@ -52,7 +52,7 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454

55-
- uses: actions/checkout@v2
55+
- uses: actions/checkout@v4
5656

5757
- name: Run semantic-release
5858
if: github.repository == 'casbin/xorm-adapter' && github.event_name == 'push'

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)