grafana-migrator icon indicating copy to clipboard operation
grafana-migrator copied to clipboard

"external" column in team_member schema needs to be cast

Open svet-b opened this issue 5 years ago • 1 comments

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;

svet-b avatar Apr 23 '19 19:04 svet-b