martinjw/dbschemareader

Incorrect default value for booleans during table creation

Arnagos opened this issue · 1 comments

Given the table
image

the following SQL gets generated:

-- NEW TABLE Testing__BaseTypesDefaultValues
CREATE TABLE "Testing__BaseTypesDefaultValues"
(
...
  "Boolean" BOOL  DEFAULT FALSE,
...
);

As you can see the default for boolean columns with default "true" gets set to "false".

As a side note:
Running a migration to fix this generates an incorrect comment (false -> false instead of false -> true):

-- Testing__BaseTypesDefaultValues from "Boolean" BOOL  DEFAULT FALSE to "Boolean" BOOL  DEFAULT FALSE
...
ALTER TABLE "public"."Testing__BaseTypesDefaultValues" ALTER COLUMN "Boolean" SET DEFAULT true;
...