-
Notifications
You must be signed in to change notification settings - Fork 16
Description
psql outputs it's NOTICE messages to stderr causing the whole action to fail even if the exit code is 0.
The offending lines of code:
postgresql/src/PsqlFilesExecutor.ts
Lines 27 to 33 in f82d2b2
| const options: any = { | |
| listeners: { | |
| stderr: (data: Buffer) => { | |
| error += data.toString(); | |
| } | |
| } | |
| }; |
postgresql/src/PsqlFilesExecutor.ts
Lines 38 to 40 in f82d2b2
| if (error) { | |
| throw new Error(`error in file: ${file}\n${error}`); | |
| } |
NOTICE's should be treated as warnings not errors those would be EXCEPTION's.
Maybe there should be an option for choosing to ignore stderr and instead rely on the exit code of psql
It's trivial to get a NOTICE to fail the action.
Consider the following output generated by dotnet ef migrations script -s Proj.Bootstrap -p Proj.Data --idempotent -o migration.sql:
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
"MigrationId" character varying(150) NOT NULL,
"ProductVersion" character varying(32) NOT NULL,
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
);
START TRANSACTION;
....
COMMIT;If the __EFMigrationsHistory table already exists, the action fails, because psql:/migration.sql:5: NOTICE: relation "__EFMigrationsHistory" already exists, skipping gets written to stderr.