-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi !
I'm comparing two schema, where the newer schema has new columns with data.
The data compare feature correctly creates the INSERT statement (populating the new columns with the values), but does not include the new columns in UPDATE statements.
Example :
-- SCHEMA A
CREATE TABLE public.test (
id serial NOT NULL,
"name" varchar NULL,
CONSTRAINT test_pk PRIMARY KEY (id)
);
INSERT INTO test VALUES (1, 'john');-- SCHEMA B
CREATE TABLE public.test (
id serial NOT NULL,
"name" varchar NULL,
"surname" varchar NULL,
CONSTRAINT test_pk PRIMARY KEY (id)
);
INSERT INTO test VALUES (1, 'johnny', 'wayne');
INSERT INTO test VALUES (2, 'alfred', 'hitchcock');Using config
{
"test": {
"targetClient": {
...
"database": "testa",
...
},
"sourceClient": {
...
"database": "testb",
...
},
"compareOptions": {
...
"dataCompare": {
"enable": true,
"tables": [
{"tableSchema":"public", "tableName":"test", "tableKeyFields":["id"]}
]
}
}
}
}I get the script
-- ...
ALTER TABLE IF EXISTS "public"."test" ADD COLUMN IF NOT EXISTS "surname" varchar NULL ;
-- ...
INSERT INTO "public"."test" ("id", "name", "surname") VALUES (2, 'alfred', 'hitchcock');
UPDATE "public"."test" SET "name" = 'johnny' WHERE "id" = 1;
-- ...See that "john" is correctly updated to "johnny", but the "wayne" is not populated at all, while "hitchcock" is correctly populated for the newly inserted value.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Status
Done