ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.97k stars 266 forks source link

Atlas can't revert back data type that already changed #3081

Open afifurrohman-id opened 2 months ago

afifurrohman-id commented 2 months ago

Hello in my case i have table:

-- Update the new tmp column with value converted to boolean from old column data UPDATE "prefix"."a" SET "yes_tmp" = CASE WHEN "yes" = 0 THEN FALSE ELSE TRUE END;

-- Drop the old column ALTER TABLE "prefix"."a" DROP COLUMN "yes";

-- Rename the new tmp column to old column name ALTER TABLE "prefix"."a" RENAME COLUMN "yes_tmp" TO "yes";



but in my case when i **revert** / **down** it can't cast back from `boolean` to `smallint` and atlas exit with that error

is there any solution?
afifurrohman-id commented 2 months ago

Hi @a8m also can i ask does atlas have concept called down migration file?

afifurrohman-id commented 2 months ago

Hi @a8m also can i ask does atlas have concept called down migration file?

okay my bad, based on this docs atlas use different approach: docs