mirror of
				https://github.com/usememos/memos.git
				synced 2025-06-05 22:09:59 +02:00 
			
		
		
		
	update: seed data
This commit is contained in:
		
							
								
								
									
										14
									
								
								api/memo.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								api/memo.go
									
									
									
									
									
								
							| @@ -2,30 +2,40 @@ package api | ||||
|  | ||||
| type Memo struct { | ||||
| 	ID int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatedTs int64  `json:"createdTs"` | ||||
| 	UpdatedTs int64  `json:"updatedTs"` | ||||
| 	RowStatus string `json:"rowStatus"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Content   string `json:"content"` | ||||
| 	CreatorID int    `json:"creatorId"` | ||||
| } | ||||
|  | ||||
| type MemoCreate struct { | ||||
| 	// Standard fields | ||||
| 	CreatorID int | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Content string `json:"content"` | ||||
| } | ||||
|  | ||||
| type MemoPatch struct { | ||||
| 	ID int | ||||
|  | ||||
| 	Content   *string `json:"content"` | ||||
| 	RowStatus *string `json:"rowStatus"` | ||||
| 	// Standard fields | ||||
| 	CreatedTs *int64  `json:"createdTs"` | ||||
| 	RowStatus *string `json:"rowStatus"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Content *string `json:"content"` | ||||
| } | ||||
|  | ||||
| type MemoFind struct { | ||||
| 	ID *int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatorID *int    `json:"creatorId"` | ||||
| 	RowStatus *string `json:"rowStatus"` | ||||
| } | ||||
|   | ||||
| @@ -2,29 +2,37 @@ package api | ||||
|  | ||||
| type Resource struct { | ||||
| 	ID int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatorID int   `json:"creatorId"` | ||||
| 	CreatedTs int64 `json:"createdTs"` | ||||
| 	UpdatedTs int64 `json:"updatedTs"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Filename string `json:"filename"` | ||||
| 	Blob     []byte `json:"blob"` | ||||
| 	Type     string `json:"type"` | ||||
| 	Size     int64  `json:"size"` | ||||
|  | ||||
| 	CreatorID int `json:"creatorId"` | ||||
| } | ||||
|  | ||||
| type ResourceCreate struct { | ||||
| 	// Standard fields | ||||
| 	CreatorID int | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Filename string `json:"filename"` | ||||
| 	Blob     []byte `json:"blob"` | ||||
| 	Type     string `json:"type"` | ||||
| 	Size     int64  `json:"size"` | ||||
|  | ||||
| 	CreatorID int | ||||
| } | ||||
|  | ||||
| type ResourceFind struct { | ||||
| 	ID *int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatorID *int `json:"creatorId"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Filename *string `json:"filename"` | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,13 +2,16 @@ package api | ||||
|  | ||||
| type Shortcut struct { | ||||
| 	ID int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatorID int | ||||
| 	CreatedTs int64  `json:"createdTs"` | ||||
| 	UpdatedTs int64  `json:"updatedTs"` | ||||
| 	RowStatus string `json:"rowStatus"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Title   string `json:"title"` | ||||
| 	Payload string `json:"payload"` | ||||
| 	RowStatus string `json:"rowStatus"` | ||||
| 	CreatorID int | ||||
| } | ||||
|  | ||||
| type ShortcutCreate struct { | ||||
| @@ -23,9 +26,12 @@ type ShortcutCreate struct { | ||||
| type ShortcutPatch struct { | ||||
| 	ID int | ||||
|  | ||||
| 	// Standard fields | ||||
| 	RowStatus *string `json:"rowStatus"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Title   *string `json:"title"` | ||||
| 	Payload *string `json:"payload"` | ||||
| 	RowStatus *string `json:"rowStatus"` | ||||
| } | ||||
|  | ||||
| type ShortcutFind struct { | ||||
|   | ||||
| @@ -2,15 +2,19 @@ package api | ||||
|  | ||||
| type User struct { | ||||
| 	ID int `json:"id"` | ||||
|  | ||||
| 	// Standard fields | ||||
| 	CreatedTs int64 `json:"createdTs"` | ||||
| 	UpdatedTs int64 `json:"updatedTs"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	OpenID       string `json:"openId"` | ||||
| 	Name         string `json:"name"` | ||||
| 	PasswordHash string `json:"-"` | ||||
| } | ||||
|  | ||||
| type UserCreate struct { | ||||
| 	// Domain specific fields | ||||
| 	OpenID       string | ||||
| 	Name         string | ||||
| 	PasswordHash string | ||||
| @@ -19,9 +23,9 @@ type UserCreate struct { | ||||
| type UserPatch struct { | ||||
| 	ID int | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	OpenID       *string | ||||
| 	PasswordHash *string | ||||
|  | ||||
| 	Name         *string `json:"name"` | ||||
| 	Password     *string `json:"password"` | ||||
| 	ResetOpenID  *bool   `json:"resetOpenId"` | ||||
| @@ -30,6 +34,7 @@ type UserPatch struct { | ||||
| type UserFind struct { | ||||
| 	ID *int `json:"id"` | ||||
|  | ||||
| 	// Domain specific fields | ||||
| 	Name   *string `json:"name"` | ||||
| 	OpenID *string | ||||
| } | ||||
|   | ||||
| @@ -62,7 +62,7 @@ CREATE TABLE shortcut ( | ||||
|   updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), | ||||
|  | ||||
|   title TEXT NOT NULL DEFAULT '', | ||||
|   payload TEXT NOT NULL DEFAULT '', | ||||
|   payload TEXT NOT NULL DEFAULT '{}', | ||||
|   creator_id INTEGER NOT NULL, | ||||
|   -- allowed row status are 'NORMAL', 'ARCHIVED'. | ||||
|   row_status TEXT NOT NULL DEFAULT 'NORMAL', | ||||
|   | ||||
| @@ -13,3 +13,19 @@ VALUES | ||||
|     -- "secret" | ||||
|     '$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK' | ||||
|   ); | ||||
|  | ||||
| INSERT INTO  | ||||
|   user ( | ||||
|     `id`,  | ||||
|     `name`,  | ||||
|     `open_id`, | ||||
|     `password_hash` | ||||
|   ) | ||||
| VALUES | ||||
|   ( | ||||
|     102,  | ||||
|     'dear_musk',  | ||||
|     'guest_open_id', | ||||
|     -- "secret" | ||||
|     '$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK' | ||||
|   ); | ||||
|   | ||||
							
								
								
									
										10
									
								
								store/seed/10002__shortcut.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								store/seed/10002__shortcut.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| INSERT INTO  | ||||
|   shortcut ( | ||||
|     `title`,  | ||||
|     `creator_id` | ||||
|   ) | ||||
| VALUES | ||||
|   ( | ||||
|     'All my memos',  | ||||
|     101 | ||||
|   ); | ||||
		Reference in New Issue
	
	Block a user