From 51b9acfc84fa3781a737f602c9dd001081f22622 Mon Sep 17 00:00:00 2001 From: pasha1coil Date: Fri, 14 Nov 2025 14:20:40 +0300 Subject: [PATCH] change types some columns in table YclientsServices --- dal/schema/000029_init.down.sql | 7 ++++++- dal/schema/000029_init.up.sql | 7 ++++++- dal/sqlcgen/models.go | 6 +++--- dal/sqlcgen/queries.sql.go | 18 +++++++++--------- model/yclients.go | 10 +++++----- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/dal/schema/000029_init.down.sql b/dal/schema/000029_init.down.sql index e9be11b..c88ff44 100644 --- a/dal/schema/000029_init.down.sql +++ b/dal/schema/000029_init.down.sql @@ -18,4 +18,9 @@ ALTER COLUMN DatesSettings SET DEFAULT '{}'::jsonb; UPDATE YclientsTimeSlots SET DatesSettings = '{}'::jsonb -WHERE DatesSettings = '[]'::jsonb; \ No newline at end of file +WHERE DatesSettings = '[]'::jsonb; + +ALTER TABLE YclientsServices +ALTER COLUMN PriceMin TYPE TEXT, +ALTER COLUMN PriceMax TYPE TEXT, +ALTER COLUMN Discount TYPE TEXT; \ No newline at end of file diff --git a/dal/schema/000029_init.up.sql b/dal/schema/000029_init.up.sql index 29b0b85..5bb333e 100644 --- a/dal/schema/000029_init.up.sql +++ b/dal/schema/000029_init.up.sql @@ -10,4 +10,9 @@ ALTER COLUMN DatesSettings SET DEFAULT '[]'::jsonb; UPDATE YclientsTimeSlots SET DatesSettings = '[]'::jsonb -WHERE DatesSettings = '{}'::jsonb; \ No newline at end of file +WHERE DatesSettings = '{}'::jsonb; + +ALTER TABLE YclientsServices +ALTER COLUMN PriceMin TYPE FLOAT USING NULLIF(PriceMin, '')::FLOAT, +ALTER COLUMN PriceMax TYPE FLOAT USING NULLIF(PriceMax, '')::FLOAT, +ALTER COLUMN Discount TYPE INT USING NULLIF(Discount, '')::INT; \ No newline at end of file diff --git a/dal/sqlcgen/models.go b/dal/sqlcgen/models.go index b5bdf39..4481773 100644 --- a/dal/sqlcgen/models.go +++ b/dal/sqlcgen/models.go @@ -465,9 +465,9 @@ type Yclientsservice struct { Salonserviceid int32 `db:"salonserviceid" json:"salonserviceid"` Title string `db:"title" json:"title"` Categoryid int32 `db:"categoryid" json:"categoryid"` - Pricemin string `db:"pricemin" json:"pricemin"` - Pricemax string `db:"pricemax" json:"pricemax"` - Discount string `db:"discount" json:"discount"` + Pricemin float64 `db:"pricemin" json:"pricemin"` + Pricemax float64 `db:"pricemax" json:"pricemax"` + Discount int32 `db:"discount" json:"discount"` Comment string `db:"comment" json:"comment"` Active bool `db:"active" json:"active"` Apiid string `db:"apiid" json:"apiid"` diff --git a/dal/sqlcgen/queries.sql.go b/dal/sqlcgen/queries.sql.go index cfa2b31..67f543e 100644 --- a/dal/sqlcgen/queries.sql.go +++ b/dal/sqlcgen/queries.sql.go @@ -150,9 +150,9 @@ type AddYclientsAccountServiceParams struct { Salonserviceid int32 `db:"salonserviceid" json:"salonserviceid"` Title string `db:"title" json:"title"` Categoryid int32 `db:"categoryid" json:"categoryid"` - Pricemin string `db:"pricemin" json:"pricemin"` - Pricemax string `db:"pricemax" json:"pricemax"` - Discount string `db:"discount" json:"discount"` + Pricemin float64 `db:"pricemin" json:"pricemin"` + Pricemax float64 `db:"pricemax" json:"pricemax"` + Discount int32 `db:"discount" json:"discount"` Comment string `db:"comment" json:"comment"` Active bool `db:"active" json:"active"` Apiid string `db:"apiid" json:"apiid"` @@ -3952,9 +3952,9 @@ type GetServicesYclientsWithPaginationRow struct { Salonserviceid int32 `db:"salonserviceid" json:"salonserviceid"` Title string `db:"title" json:"title"` Categoryid int32 `db:"categoryid" json:"categoryid"` - Pricemin string `db:"pricemin" json:"pricemin"` - Pricemax string `db:"pricemax" json:"pricemax"` - Discount string `db:"discount" json:"discount"` + Pricemin float64 `db:"pricemin" json:"pricemin"` + Pricemax float64 `db:"pricemax" json:"pricemax"` + Discount int32 `db:"discount" json:"discount"` Comment string `db:"comment" json:"comment"` Active bool `db:"active" json:"active"` Apiid string `db:"apiid" json:"apiid"` @@ -6520,9 +6520,9 @@ type UpdateYclientsAccountServicesParams struct { Salonserviceid int32 `db:"salonserviceid" json:"salonserviceid"` Title string `db:"title" json:"title"` Categoryid int32 `db:"categoryid" json:"categoryid"` - Pricemin string `db:"pricemin" json:"pricemin"` - Pricemax string `db:"pricemax" json:"pricemax"` - Discount string `db:"discount" json:"discount"` + Pricemin float64 `db:"pricemin" json:"pricemin"` + Pricemax float64 `db:"pricemax" json:"pricemax"` + Discount int32 `db:"discount" json:"discount"` Comment string `db:"comment" json:"comment"` Active bool `db:"active" json:"active"` Apiid string `db:"apiid" json:"apiid"` diff --git a/model/yclients.go b/model/yclients.go index 6f8ba09..55173bd 100644 --- a/model/yclients.go +++ b/model/yclients.go @@ -56,9 +56,9 @@ type YclientsServices struct { SalonServiceID int32 `json:"salon_service_id"` Title string `json:"title"` CategoryID int32 `json:"categoryID"` - PriceMin string `json:"priceMin"` - PriceMax string `json:"priceMax"` - Discount string `json:"discount"` + PriceMin float64 `json:"priceMin"` + PriceMax float64 `json:"priceMax"` + Discount int32 `json:"discount"` Comment string `json:"comment"` Active bool `json:"active"` ApiID string `json:"apiID"` @@ -68,8 +68,8 @@ type YclientsServices struct { } type YclientsServiceStaff struct { - ID string `json:"id"` - SeanceLength string `json:"seance_length"` + ID int `json:"id"` + SeanceLength int `json:"seance_length"` } type ServicesListYclientsResp struct { Count int64 `json:"count"`