Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9df64bca
authored
May 16, 2024
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: try to fix sqlite database migration (#231)
parent
80740d8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
model/main.go
+6
-6
model/token.go
+1
-1
No files found.
model/main.go
View file @
9df64bca
...
...
@@ -93,12 +93,12 @@ func InitDB() (err error) {
if
!
common
.
IsMasterNode
{
return
nil
}
if
common
.
UsingMySQL
{
_
,
_
=
sqlDB
.
Exec
(
"DROP INDEX idx_channels_key ON channels;"
)
// TODO: delete this line when most users have upgraded
_
,
_
=
sqlDB
.
Exec
(
"ALTER TABLE midjourneys MODIFY action VARCHAR(40);"
)
// TODO: delete this line when most users have upgraded
_
,
_
=
sqlDB
.
Exec
(
"ALTER TABLE midjourneys MODIFY progress VARCHAR(30);"
)
// TODO: delete this line when most users have upgraded
_
,
_
=
sqlDB
.
Exec
(
"ALTER TABLE midjourneys MODIFY status VARCHAR(20);"
)
// TODO: delete this line when most users have upgraded
}
//
if common.UsingMySQL {
//
_, _ = sqlDB.Exec("DROP INDEX idx_channels_key ON channels;") // TODO: delete this line when most users have upgraded
//
_, _ = sqlDB.Exec("ALTER TABLE midjourneys MODIFY action VARCHAR(40);") // TODO: delete this line when most users have upgraded
//
_, _ = sqlDB.Exec("ALTER TABLE midjourneys MODIFY progress VARCHAR(30);") // TODO: delete this line when most users have upgraded
//
_, _ = sqlDB.Exec("ALTER TABLE midjourneys MODIFY status VARCHAR(20);") // TODO: delete this line when most users have upgraded
//
}
common
.
SysLog
(
"database migration started"
)
err
=
db
.
AutoMigrate
(
&
Channel
{})
if
err
!=
nil
{
...
...
model/token.go
View file @
9df64bca
...
...
@@ -11,7 +11,7 @@ import (
type
Token
struct
{
Id
int
`json:"id"`
UserId
int
`json:"user_id"`
UserId
int
`json:"user_id"
gorm:"index"
`
Key
string
`json:"key" gorm:"type:char(48);uniqueIndex"`
Status
int
`json:"status" gorm:"default:1"`
Name
string
`json:"name" gorm:"index" `
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment