Cleanup App data (#19571)

This commit is contained in:
Mohit Yadav 2025-01-28 19:22:33 +05:30 committed by GitHub
parent aab8973096
commit cb7942f4b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -2,4 +2,5 @@
ALTER TABLE apps_data_store ADD CONSTRAINT entity_relationship_pky PRIMARY KEY (identifier, type);
UPDATE user_entity SET json = JSON_SET(json, '$.isBot', false) WHERE JSON_EXTRACT(json, '$.isBot') IS NULL;
ALTER TABLE user_entity ADD COLUMN isBot BOOLEAN GENERATED ALWAYS AS (json -> '$.isBot') NOT NULL;
CREATE INDEX idx_isBot ON user_entity (isBot);
CREATE INDEX idx_isBot ON user_entity (isBot);
DELETE from apps_data_store;

View File

@ -2,4 +2,5 @@
ALTER TABLE apps_data_store ADD CONSTRAINT entity_relationship_pky PRIMARY KEY (identifier, type);
UPDATE user_entity SET json = jsonb_set(json::jsonb, '{isBot}', 'false'::jsonb, true) WHERE NOT (json ?? 'isBot');
ALTER TABLE user_entity ADD COLUMN isBot BOOLEAN GENERATED ALWAYS AS ((json ->> 'deleted')::boolean) STORED NOT NULL;
CREATE INDEX idx_isBot ON user_entity (isBot);
CREATE INDEX idx_isBot ON user_entity (isBot);
DELETE from apps_data_store;