Skip to content

Commit

Permalink
fix: migration script
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Sep 16, 2023
1 parent a3d7cc9 commit 3a1f82e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion store/db/migration/prod/0.15/00__drop_user_open_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ FROM

DROP TABLE user;

ALTER TABLE user_temp RENAME TO user_temp;
ALTER TABLE user_temp RENAME TO user;

3 comments on commit 3a1f82e

@ituri
Copy link

@ituri ituri commented on 3a1f82e Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this fix the error below? Docker failed to come up again with the recent version, producing this error:

---
Server profile
dsn: /var/opt/memos/memos_prod.db
addr:
port: 5230
mode: prod
version: 0.15.0
---
succeed to copy a backup database file
start migrate
applying migration for 0.15.0
2023-09-16T06:37:44.955Z	ERROR	cmd/memos.go:52	failed to migrate db	{"error": "failed to apply minor version migration: migrate error: statement:DROP TABLE IF EXISTS user_temp;\n\nCREATE TABLE user_temp (\n  id INTEGER PRIMARY KEY AUTOINCREMENT,\n  created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),\n  updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),\n  row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL',\n  username TEXT NOT NULL UNIQUE,\n  role TEXT NOT NULL CHECK (role IN ('HOST', 'ADMIN', 'USER')) DEFAULT 'USER',\n  email TEXT NOT NULL DEFAULT '',\n  nickname TEXT NOT NULL DEFAULT '',\n  password_hash TEXT NOT NULL,\n  avatar_url TEXT NOT NULL DEFAULT ''\n);\n\nINSERT INTO\n  user_temp (id, created_ts, updated_ts, row_status, username, role, email, nickname, password_hash, avatar_url)\nSELECT\n  id, created_ts, updated_ts, row_status, username, role, email, nickname, password_hash, avatar_url\nFROM\n  user;\n\nDROP TABLE user;\n\nALTER TABLE user_temp_temp RENAME TO user_temp;\n err=failed to execute statement, err: SQL logic error: no such table: user_temp_temp (1)"}
github.com/usememos/memos/cmd.glob..func1
	/backend-build/cmd/memos.go:52
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:920
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/usememos/memos/cmd.Execute
	/backend-build/cmd/memos.go:93
main.main
	/backend-build/main.go:10
runtime.main
	/usr/local/go/src/runtime/proc.go:267

@boojack
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ituri You can pull the latest version again.

@ituri
Copy link

@ituri ituri commented on 3a1f82e Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please sign in to comment.