fix column type

This commit is contained in:
nochill 2023-09-24 15:01:46 +07:00
parent 3f18f0e1c2
commit 7100a3618f
2 changed files with 8 additions and 6 deletions

View File

@ -112,7 +112,7 @@ CREATE TABLE reviews (
"comments" text not null, "comments" text not null,
"score" smallint not null, "score" smallint not null,
"is_from_critic" boolean not null, "is_from_critic" boolean not null,
"is_hided" boolean, -- if comments violate TOS just hide the reviews "is_hided" boolean not null default(false), -- if comments violate TOS just hide the reviews
"location_id" integer references "locations"("id") not null, "location_id" integer references "locations"("id") not null,
"created_at" timestamp default(now()), "created_at" timestamp default(now()),
"updated_at" timestamp default(now()) "updated_at" timestamp default(now())
@ -121,7 +121,8 @@ CREATE TABLE reviews (
CREATE TYPE comment_type AS ENUM( CREATE TYPE comment_type AS ENUM(
'stories', 'stories',
'news', 'news',
'reviews' 'reviews',
'locations'
); );
CREATE TABLE comments( CREATE TABLE comments(

View File

@ -19,6 +19,7 @@ const (
CommentTypeStories CommentType = "stories" CommentTypeStories CommentType = "stories"
CommentTypeNews CommentType = "news" CommentTypeNews CommentType = "news"
CommentTypeReviews CommentType = "reviews" CommentTypeReviews CommentType = "reviews"
CommentTypeLocations CommentType = "locations"
) )
func (e *CommentType) Scan(src interface{}) error { func (e *CommentType) Scan(src interface{}) error {
@ -188,7 +189,7 @@ type Review struct {
Comments string `json:"comments"` Comments string `json:"comments"`
Score int16 `json:"score"` Score int16 `json:"score"`
IsFromCritic bool `json:"is_from_critic"` IsFromCritic bool `json:"is_from_critic"`
IsHided sql.NullBool `json:"is_hided"` IsHided bool `json:"is_hided"`
LocationID int32 `json:"location_id"` LocationID int32 `json:"location_id"`
CreatedAt sql.NullTime `json:"created_at"` CreatedAt sql.NullTime `json:"created_at"`
UpdatedAt sql.NullTime `json:"updated_at"` UpdatedAt sql.NullTime `json:"updated_at"`