mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: address comments
This commit is contained in:
10
api/memo.go
10
api/memo.go
@ -18,14 +18,14 @@ type MemoCreate struct {
|
|||||||
type MemoPatch struct {
|
type MemoPatch struct {
|
||||||
Id int
|
Id int
|
||||||
|
|
||||||
Content *string
|
Content *string `json:"content"`
|
||||||
RowStatus *string
|
RowStatus *string `json:"rowStatus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemoFind struct {
|
type MemoFind struct {
|
||||||
Id *int
|
Id *int `json:"id"`
|
||||||
CreatorId *int
|
CreatorId *int `json:"creatorId"`
|
||||||
RowStatus *string
|
RowStatus *string `json:"rowStatus"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemoDelete struct {
|
type MemoDelete struct {
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func GetDevProfile(dataDir string) Profile {
|
func GetDevProfile(dataDir string) Profile {
|
||||||
return Profile{
|
return Profile{
|
||||||
mode: "8080",
|
mode: "8080",
|
||||||
port: 1234,
|
port: 8080,
|
||||||
dsn: fmt.Sprintf("file:%s/memos_dev.db", dataDir),
|
dsn: fmt.Sprintf("file:%s/memos_dev.db", dataDir),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func (m *Main) Run() error {
|
|||||||
|
|
||||||
m.db = db
|
m.db = db
|
||||||
|
|
||||||
s := server.NewServer()
|
s := server.NewServer(m.profile.port)
|
||||||
|
|
||||||
s.ShortcutService = store.NewShortcutService(db)
|
s.ShortcutService = store.NewShortcutService(db)
|
||||||
s.MemoService = store.NewMemoService(db)
|
s.MemoService = store.NewMemoService(db)
|
||||||
|
9
go.mod
9
go.mod
@ -8,9 +8,6 @@ require github.com/google/uuid v1.3.0
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||||
github.com/gorilla/context v1.1.1 // indirect
|
|
||||||
github.com/labstack/echo/v4 v4.6.3
|
|
||||||
github.com/labstack/gommon v0.3.1 // indirect
|
|
||||||
github.com/mattn/go-colorable v0.1.11 // indirect
|
github.com/mattn/go-colorable v0.1.11 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
@ -22,6 +19,12 @@ require (
|
|||||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
|
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gorilla/context v1.1.1 // indirect
|
||||||
|
github.com/labstack/echo/v4 v4.6.3
|
||||||
|
github.com/labstack/gommon v0.3.1 // indirect
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||||
github.com/gorilla/sessions v1.2.1
|
github.com/gorilla/sessions v1.2.1
|
||||||
|
@ -28,7 +28,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
|
|||||||
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User not found: %s", login.Name))
|
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User not found: %s", login.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare the stored hashed password, with the hashed version of the password that was received.
|
// Compare the stored password
|
||||||
if login.Password != user.Password {
|
if login.Password != user.Password {
|
||||||
// If the two passwords don't match, return a 401 status.
|
// If the two passwords don't match, return a 401 status.
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, "Incorrect password").SetInternal(err)
|
return echo.NewHTTPError(http.StatusUnauthorized, "Incorrect password").SetInternal(err)
|
||||||
@ -41,7 +41,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create user response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode user response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -69,7 +69,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
|
|||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to authenticate user").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to authenticate user").SetInternal(err)
|
||||||
}
|
}
|
||||||
if user != nil {
|
if user != nil {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Exist user found: %s", signup.Name))
|
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Existed user found: %s", signup.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
userCreate := &api.UserCreate{
|
userCreate := &api.UserCreate{
|
||||||
@ -89,7 +89,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create user response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode created user response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -59,7 +59,7 @@ func removeUserSession(c echo.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use session instead of jwt in the initial version
|
// Use session in the initial version
|
||||||
func BasicAuthMiddleware(us api.UserService, next echo.HandlerFunc) echo.HandlerFunc {
|
func BasicAuthMiddleware(us api.UserService, next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
// Skips auth
|
// Skips auth
|
||||||
@ -88,13 +88,13 @@ func BasicAuthMiddleware(us api.UserService, next echo.HandlerFunc) echo.Handler
|
|||||||
}
|
}
|
||||||
user, err := us.FindUser(principalFind)
|
user, err := us.FindUser(principalFind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", userId)).SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by ID: %d", userId)).SetInternal(err)
|
||||||
}
|
}
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", userId))
|
return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Not found user ID: %d", userId))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stores principalID into context.
|
// Stores userId into context.
|
||||||
c.Set(getUserIdContextKey(), userId)
|
c.Set(getUserIdContextKey(), userId)
|
||||||
return next(c)
|
return next(c)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode memo response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -53,7 +53,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode memo response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -81,7 +81,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo list response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode memo list response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -105,7 +105,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode memo response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -54,7 +54,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(resource)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(resource)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode shortcut response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -71,7 +71,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal resource list response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode resource list response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,7 +22,7 @@ type Server struct {
|
|||||||
port int
|
port int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer() *Server {
|
func NewServer(port int) *Server {
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
e.Debug = true
|
e.Debug = true
|
||||||
e.HideBanner = true
|
e.HideBanner = true
|
||||||
@ -49,7 +49,7 @@ func NewServer() *Server {
|
|||||||
|
|
||||||
s := &Server{
|
s := &Server{
|
||||||
e: e,
|
e: e,
|
||||||
port: 8080,
|
port: port,
|
||||||
}
|
}
|
||||||
|
|
||||||
webhookGroup := e.Group("/h")
|
webhookGroup := e.Group("/h")
|
||||||
|
@ -27,7 +27,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode shortcut response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -52,7 +52,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode shortcut response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -69,7 +69,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(list)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut list response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode shortcut list response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -90,7 +90,7 @@ func (s *Server) registerShortcutRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(shortcut)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal shortcut response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode shortcut response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -28,7 +28,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal user response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode user response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -58,7 +58,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(isUsable)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(isUsable)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal rename check response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode rename check response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -90,7 +90,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(isValid)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(isValid)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal password check response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode password check response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -116,7 +116,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(user)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal user response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode user response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -42,7 +42,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
|
|||||||
|
|
||||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
|
||||||
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
if err := json.NewEncoder(c.Response().Writer).Encode(composeResponse(memo)); err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal memo response").SetInternal(err)
|
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to encode memo response").SetInternal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -12,7 +12,7 @@ CREATE TABLE user (
|
|||||||
INSERT INTO
|
INSERT INTO
|
||||||
sqlite_sequence (name, seq)
|
sqlite_sequence (name, seq)
|
||||||
VALUES
|
VALUES
|
||||||
('user', 0);
|
('user', 100);
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_user_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_user_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
@ -72,7 +72,7 @@ CREATE TABLE shortcut (
|
|||||||
INSERT INTO
|
INSERT INTO
|
||||||
sqlite_sequence (name, seq)
|
sqlite_sequence (name, seq)
|
||||||
VALUES
|
VALUES
|
||||||
('shortcut', 0);
|
('shortcut', 100);
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_shortcut_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_shortcut_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
@ -99,6 +99,11 @@ CREATE TABLE resource (
|
|||||||
FOREIGN KEY(creator_id) REFERENCES users(id)
|
FOREIGN KEY(creator_id) REFERENCES users(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
INSERT INTO
|
||||||
|
sqlite_sequence (name, seq)
|
||||||
|
VALUES
|
||||||
|
('resource', 100);
|
||||||
|
|
||||||
CREATE TRIGGER IF NOT EXISTS `trigger_update_resource_modification_time`
|
CREATE TRIGGER IF NOT EXISTS `trigger_update_resource_modification_time`
|
||||||
AFTER
|
AFTER
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -116,10 +121,8 @@ INSERT INTO user
|
|||||||
(`id`, `name`, `password`, `open_id`)
|
(`id`, `name`, `password`, `open_id`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'guest', '123456', 'guest_open_id'),
|
(1, 'guest', '123456', 'guest_open_id'),
|
||||||
(2, 'mine', '123456', 'mine_open_id');
|
|
||||||
|
|
||||||
INSERT INTO memo
|
INSERT INTO memo
|
||||||
(`content`, `creator_id`)
|
(`content`, `creator_id`)
|
||||||
VALUES
|
VALUES
|
||||||
('👋 Welcome to memos', 1),
|
('👋 Welcome to memos', 1),
|
||||||
('👋 Welcome to memos', 2);
|
|
||||||
|
Reference in New Issue
Block a user