feat: update model
This commit is contained in:
@@ -7,7 +7,7 @@ CREATE TABLE posts(
|
|||||||
deleted_at timestamp,
|
deleted_at timestamp,
|
||||||
status int2 NOT NULL DEFAULT 0,
|
status int2 NOT NULL DEFAULT 0,
|
||||||
title varchar(128) NOT NULL,
|
title varchar(128) NOT NULL,
|
||||||
head_image int8 NOT NULL DEFAULT 0,
|
head_images jsonb DEFAULT '[]' ::jsonb NOT NULL,
|
||||||
description varchar(256) NOT NULL,
|
description varchar(256) NOT NULL,
|
||||||
content text NOT NULL,
|
content text NOT NULL,
|
||||||
price int8 NOT NULL DEFAULT 0,
|
price int8 NOT NULL DEFAULT 0,
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ type Posts struct {
|
|||||||
Likes int64 `json:"likes"`
|
Likes int64 `json:"likes"`
|
||||||
Tags fields.Json[[]string] `json:"tags"`
|
Tags fields.Json[[]string] `json:"tags"`
|
||||||
Assets fields.Json[[]fields.MediaAsset] `json:"assets"`
|
Assets fields.Json[[]fields.MediaAsset] `json:"assets"`
|
||||||
|
HeadImages string `json:"head_images"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ type postsTable struct {
|
|||||||
Likes postgres.ColumnInteger
|
Likes postgres.ColumnInteger
|
||||||
Tags postgres.ColumnString
|
Tags postgres.ColumnString
|
||||||
Assets postgres.ColumnString
|
Assets postgres.ColumnString
|
||||||
|
HeadImages postgres.ColumnString
|
||||||
|
|
||||||
AllColumns postgres.ColumnList
|
AllColumns postgres.ColumnList
|
||||||
MutableColumns postgres.ColumnList
|
MutableColumns postgres.ColumnList
|
||||||
@@ -85,8 +86,9 @@ func newPostsTableImpl(schemaName, tableName, alias string) postsTable {
|
|||||||
LikesColumn = postgres.IntegerColumn("likes")
|
LikesColumn = postgres.IntegerColumn("likes")
|
||||||
TagsColumn = postgres.StringColumn("tags")
|
TagsColumn = postgres.StringColumn("tags")
|
||||||
AssetsColumn = postgres.StringColumn("assets")
|
AssetsColumn = postgres.StringColumn("assets")
|
||||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
HeadImagesColumn = postgres.StringColumn("head_images")
|
||||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
||||||
|
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
||||||
)
|
)
|
||||||
|
|
||||||
return postsTable{
|
return postsTable{
|
||||||
@@ -107,6 +109,7 @@ func newPostsTableImpl(schemaName, tableName, alias string) postsTable {
|
|||||||
Likes: LikesColumn,
|
Likes: LikesColumn,
|
||||||
Tags: TagsColumn,
|
Tags: TagsColumn,
|
||||||
Assets: AssetsColumn,
|
Assets: AssetsColumn,
|
||||||
|
HeadImages: HeadImagesColumn,
|
||||||
|
|
||||||
AllColumns: allColumns,
|
AllColumns: allColumns,
|
||||||
MutableColumns: mutableColumns,
|
MutableColumns: mutableColumns,
|
||||||
|
|||||||
Reference in New Issue
Block a user