rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.16k stars 269 forks source link

Error: unterminated dollar-quoted string at or near "$$ DECLARE row record" #221

Closed rohitjha941 closed 1 year ago

rohitjha941 commented 1 year ago

I am getting the following error while running the migration. I am trying to migrate from official lib

Migration failed: pq: unterminated dollar-quoted string at or near "$$ DECLARE row record" 

Migration code is

DO $$ DECLARE row record;

BEGIN FOR row IN
select
    table_name
from
    information_schema.columns
where
    column_name = 'created_at' LOOP EXECUTE 'ALTER TABLE public.' || quote_ident(row.table_name) || ' alter column created_at type timestamp with time zone using created_at at time zone ''UTC''';

END LOOP;

END;

$$;