chore: update prod schema

This commit is contained in:
Steven 2022-08-20 11:36:24 +08:00
parent f06a3d171b
commit 68b30063a9
2 changed files with 13 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package server
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"strconv" "strconv"
@ -39,7 +39,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
} }
defer src.Close() defer src.Close()
fileBytes, err := ioutil.ReadAll(src) fileBytes, err := io.ReadAll(src)
if err != nil { if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to read file").SetInternal(err) return echo.NewHTTPError(http.StatusInternalServerError, "Failed to read file").SetInternal(err)
} }

View File

@ -3,6 +3,7 @@ DROP TABLE IF EXISTS `memo_organizer`;
DROP TABLE IF EXISTS `memo`; DROP TABLE IF EXISTS `memo`;
DROP TABLE IF EXISTS `shortcut`; DROP TABLE IF EXISTS `shortcut`;
DROP TABLE IF EXISTS `resource`; DROP TABLE IF EXISTS `resource`;
DROP TABLE IF EXISTS `user_setting`;
DROP TABLE IF EXISTS `user`; DROP TABLE IF EXISTS `user`;
-- user -- user
@ -139,3 +140,13 @@ SET
WHERE WHERE
rowid = old.rowid; rowid = old.rowid;
END; END;
-- user_setting
CREATE TABLE user_setting (
user_id INTEGER NOT NULL,
key TEXT NOT NULL,
value TEXT NOT NULL,
FOREIGN KEY(user_id) REFERENCES user(id) ON DELETE CASCADE
);
CREATE UNIQUE INDEX user_setting_key_user_id_index ON user_setting(key, user_id);