grafana-migrator
grafana-migrator copied to clipboard
"external" column in team_member schema needs to be cast
Getting a few of the following with the current version of the migrate.sh script:
ERROR: column "external" is of type boolean but expression is of type integer
LINE 1: ...(2,11,5,12,'2019-02-03 07:17:02','2019-02-03 07:17:02',0);
^
HINT: You will need to rewrite or cast the expression.
This is due to the external
column in the the team_member
table not being cast to bool.
The following snippets can be added to migrate.sh
to address this:
ALTER TABLE team_member ALTER COLUMN external TYPE integer USING external::integer;
and
ALTER TABLE team_member
ALTER COLUMN external TYPE boolean
USING CASE WHEN external = 0 THEN FALSE
WHEN external = 1 THEN TRUE
ELSE NULL
END;