fix dirty merge

This commit is contained in:
Pasha 2025-11-21 20:53:23 +03:00
parent 7519f43ba3
commit c92611e280
2 changed files with 44 additions and 0 deletions

@ -0,0 +1,26 @@
CREATE TABLE IF NOT EXISTS YclientsTokens (
AccountID VARCHAR(30) PRIMARY KEY,
SalonID int not null, -- ID компании
AccessToken TEXT NOT NULL DEFAULT '',
Active BOOLEAN NOT NULL DEFAULT FALSE,
Expiration BOOLEAN NOT NULL DEFAULT FALSE, -- флаг истек ли токен
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
create UNIQUE INDEX idx_unique_tokens_yclients ON YclientsTokens (SalonID, AccountID) WHERE Active = true and Expiration = false;
ALTER TABLE YclientsAccounts
ADD COLUMN IF NOT EXISTS ShortDecription text NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS Country VARCHAR(50) NOT NULL DEFAULT '';
ALTER TABLE YclientsTimeSlots
ALTER COLUMN DatesSettings SET DEFAULT '{}'::jsonb;
UPDATE YclientsTimeSlots
SET DatesSettings = '{}'::jsonb
WHERE DatesSettings = '[]'::jsonb;
ALTER TABLE YclientsServices
ALTER COLUMN PriceMin TYPE TEXT,
ALTER COLUMN PriceMax TYPE TEXT,
ALTER COLUMN Discount TYPE TEXT;

@ -0,0 +1,18 @@
DROP INDEX if EXISTS idx_unique_tokens_yclients;
DROP TABLE IF EXISTS YclientsTokens;
ALTER TABLE YclientsAccounts
DROP COLUMN IF EXISTS ShortDecription,
DROP COLUMN IF EXISTS Country;
ALTER TABLE YclientsTimeSlots
ALTER COLUMN DatesSettings SET DEFAULT '[]'::jsonb;
UPDATE YclientsTimeSlots
SET DatesSettings = '[]'::jsonb
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;