usememos / memos

An open-source, lightweight note-taking solution. The pain-less way to create your meaningful notes. Your Notes, Your Way.
https://usememos.com
MIT License
34.06k stars 2.47k forks source link

0.21.0升级报错 #3197

Closed wmbin closed 6 months ago

wmbin commented 7 months ago

Describe the bug

由通过docker 将v0.20.1升级至0.21.0 提示报错

ERROR failed to migrate database !BADKEY="Error 1060 (42S21): Duplicate column name 'description'\nmigrate error: ALTER TABLEuserADD COLUMNdescriptionVARCHAR(256) NOT NULL DEFAULT ''\ngithub.com/usememos/memos/store/db/mysql.(*DB).applyMigrationForMinorVersion\n\t/backend-build/store/db/mysql/migrator.go:131\ngithub.com/usememos/memos/store/db/mysql.(*DB).prodMigrate\n\t/backend-build/store/db/mysql/migrator.go:104\ngithub.com/usememos/memos/store/db/mysql.(*DB).Migrate\n\t/backend-build/store/db/mysql/migrator.go:30\nmain.init.func1\n\t/backend-build/bin/memos/main.go:55\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.Execute\n\t/backend-build/bin/memos/main.go:105\nmain.main\n\t/backend-build/bin/memos/main.go:201\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695\nfailed to apply minor version migration\ngithub.com/usememos/memos/store/db/mysql.(*DB).prodMigrate\n\t/backend-build/store/db/mysql/migrator.go:105\ngithub.com/usememos/memos/store/db/mysql.(*DB).Migrate\n\t/backend-build/store/db/mysql/migrator.go:30\nmain.init.func1\n\t/backend-build/bin/memos/main.go:55\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.Execute\n\t/backend-build/bin/memos/main.go:105\nmain.main\n\t/backend-build/bin/memos/main.go:201\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695"

Steps to reproduce

升级

The version of Memos you're using

0.21.0

Screenshots or additional context

No response

Issues-translate-bot commented 7 months ago

Issue is not in English. It has been translated automatically.


Title: 0.21.0 upgrade error

eallion commented 7 months ago

Me too

Server profile
version: 0.21.0
data: /var/opt/memos
dsn: /var/opt/memos/memos_prod.db
addr: 
port: 5230
mode: prod
driver: sqlite
frontend: true
---
succeed to copy a backup database file
start migrate
applying migration for 0.21.0
2024/04/12 15:51:00 ERROR failed to migrate database !BADKEY="SQL logic error: duplicate column name: description (1)\nfailed to execute statement\ngithub.com/usememos/memos/store/db/sqlite.(*DB).execute\n\t/backend-build/store/db/sqlite/migrator.go:206\ngithub.com/usememos/memos/store/db/sqlite.(*DB).applyMigrationForMinorVersion\n\t/backend-build/store/db/sqlite/migrator.go:159\ngithub.com/usememos/memos/store/db/sqlite.(*DB).Migrate\n\t/backend-build/store/db/sqlite/migrator.go:90\nmain.init.func1\n\t/backend-build/bin/memos/main.go:55\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.Execute\n\t/backend-build/bin/memos/main.go:105\nmain.main\n\t/backend-build/bin/memos/main.go:201\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695\nmigrate error: ALTER TABLE user ADD COLUMN description TEXT NOT NULL DEFAULT \"\";\n\ngithub.com/usememos/memos/store/db/sqlite.(*DB).applyMigrationForMinorVersion\n\t/backend-build/store/db/sqlite/migrator.go:160\ngithub.com/usememos/memos/store/db/sqlite.(*DB).Migrate\n\t/backend-build/store/db/sqlite/migrator.go:90\nmain.init.func1\n\t/backend-build/bin/memos/main.go:55\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.Execute\n\t/backend-build/bin/memos/main.go:105\nmain.main\n\t/backend-build/bin/memos/main.go:201\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695\nfailed to apply minor version migration\ngithub.com/usememos/memos/store/db/sqlite.(*DB).Migrate\n\t/backend-build/store/db/sqlite/migrator.go:91\nmain.init.func1\n\t/backend-build/bin/memos/main.go:55\ngithub.com/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987\ngithub.com/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115\ngithub.com/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039\nmain.Execute\n\t/backend-build/bin/memos/main.go:105\nmain.main\n\t/backend-build/bin/memos/main.go:201\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:271\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695"
wayner6 commented 6 months ago

请问怎么解决了?

Issues-translate-bot commented 6 months ago

Issue is not in English. It has been translated automatically.


How did you solve it?

xcdmrCHP commented 5 months ago

可以看看这一篇 https://github.com/usememos/memos/issues/3348#issuecomment-2106081619

Issues-translate-bot commented 5 months ago

Issue is not in English. It has been translated automatically.


You can read this article https://github.com/usememos/memos/issues/3348#issuecomment-2106081619