Giter Site home page Giter Site logo

Comments (6)

a8m avatar a8m commented on September 24, 2024 1

Fixed with #811. Thanks @amrnt 🙏

from atlas.

a8m avatar a8m commented on September 24, 2024

Thanks for reporting this @amrnt 🙏

from atlas.

amrnt avatar amrnt commented on September 24, 2024

@a8m, I tried to change the StorageKey of an edge, it will drop and create the CONSTRAINT but the order of it will yield to errors as the same issue, the column is removed before the constraint:

 		edge.To("deliveries", Delivery.Type).
-			StorageKey(edge.Column("address_id")),
+			StorageKey(edge.Column("delivery_address_id")),
ALTER TABLE "deliveries"
  DROP COLUMN "address_id", 
  ADD COLUMN "delivery_address_id" character varying NOT NULL, 
  DROP CONSTRAINT "deliveries_addresses_deliveries", 
  ADD CONSTRAINT "deliveries_addresses_deliveries" FOREIGN KEY ("delivery_address_id") REFERENCES "addresses" ("id") ON DELETE NO ACTION;

from atlas.

a8m avatar a8m commented on September 24, 2024

Hey @amrnt 👋,
What Ent and Atlas versions do you use? Thanks

from atlas.

amrnt avatar amrnt commented on September 24, 2024

latest I think,

	ariga.io/atlas v0.4.2-0.20220523090332-08a1147dfc44
	entgo.io/contrib v0.2.1-0.20220515130829-06b73685c304
	entgo.io/ent v0.10.2-0.20220521203114-1e05ccc28448

I checked other migration when fixed the original issue, the order is just fine. But this for the case where you change the column name.

from atlas.

a8m avatar a8m commented on September 24, 2024

OK, thanks. I'll give it a look tomorrow morning. For renaming, we plan to add an API to detect such changes (avoid drop and add).

from atlas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.