Skip to content

Commit

Permalink
Add onboarding SQL
Browse files Browse the repository at this point in the history
mohityadav766 committed Jan 28, 2025
1 parent 408c393 commit 2822329
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bootstrap/sql/migrations/native/1.6.3/mysql/schemaChanges.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Add constraint to apps_data_store
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);
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Add constraint to apps_data_store
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);
Original file line number Diff line number Diff line change
@@ -4830,11 +4830,11 @@ default String getTimeSeriesTableName() {
interface AppsDataStore {
@ConnectionAwareSqlUpdate(
value =
"INSERT INTO apps_data_store(identifier, type, json) VALUES (:identifier, :type, :json)",
"INSERT INTO apps_data_store(identifier, type, json) VALUES (:identifier, :type, :json) ON DUPLICATE KEY UPDATE json = VALUES(json)",
connectionType = MYSQL)
@ConnectionAwareSqlUpdate(
value =
"INSERT INTO apps_data_store(identifier, type, json) VALUES (:identifier, :type, :json :: jsonb)",
"INSERT INTO apps_data_store(identifier, type, json) VALUES (:identifier, :type, :json :: jsonb) ON CONFLICT (identifier, type) DO UPDATE SET json = EXCLUDED.json",
connectionType = POSTGRES)
void insert(
@Bind("identifier") String identifier,

0 comments on commit 2822329

Please sign in to comment.