mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-26 16:22:09 +00:00
Add Onboarding SQL (#19525)
* Add Primary Key Migration * Update queries and conflict on apps data store * Update queries and conflict on apps data store * add index on isBot
This commit is contained in:
parent
5118bd6048
commit
58d5988a16
@ -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);
|
||||
@ -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);
|
||||
@ -4893,11 +4893,11 @@ public interface CollectionDAO {
|
||||
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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user