Giter Site home page Giter Site logo

Comments (6)

josevalim avatar josevalim commented on September 28, 2024

from ecto_sql.

bgentry avatar bgentry commented on September 28, 2024

Quick question: does it work with --step instead of -n?

Nope, the argument is also ignored with mix ecto.migrate --step 1 🙁

from ecto_sql.

josevalim avatar josevalim commented on September 28, 2024

Hi @bgentry, unfortunately I cannot reproduce this using latest ecto and ecto_sql. I just started a new Phoenix app, created two different resources and did this:

~/OSS/phoenix/installer/demo[master %]$ mix ecto.migrate -n 1
[debug] QUERY OK source="schema_migrations" db=0.3ms
SELECT s0."version"::bigint FROM "schema_migrations" AS s0 FOR UPDATE []
[info] == Running 20181222002903 Demo.Repo.Migrations.CreateUsers.change/0 forward
[info] create table users
[info] == Migrated 20181222002903 in 0.0s
~/OSS/phoenix/installer/demo[master %]$ mix ecto.migrate -n 1
[debug] QUERY OK source="schema_migrations" db=0.8ms
SELECT s0."version"::bigint FROM "schema_migrations" AS s0 FOR UPDATE []
[info] == Running 20181222002912 Demo.Repo.Migrations.CreatePosts.change/0 forward
[info] create table posts
[info] == Migrated 20181222002912 in 0.0s

Have you tried using latest ecto_sql and checked if the problem persists? If so, can you prodice a way to reproduce it? Thanks.

from ecto_sql.

bgentry avatar bgentry commented on September 28, 2024

@josevalim ahh, sorry to waste your time on this 🤦‍♂️ I suspect it must be due to this alias in our mix.exs:

  defp aliases do
    [
      "ecto.migrate": ["ecto.migrate", "ecto.dump"],
      ..
    ]
  end

I guess I'll have to come up with a different way to achieve that, one that doesn't swallow args.

from ecto_sql.

josevalim avatar josevalim commented on September 28, 2024

I have changed master to perform strict argument parsing, which we should have been doing along time ago:

$ mix ecto.dump -n 1
** (Mix) Could not invoke task "ecto.dump": 1 error found!
-n : Unknown option

Btw, you can change your alias to this:

def aliases do
  ["ecto.migrate": &migrate_and_dump/1]
end

defp migrate_and_dump(args) do
  Mix.Task.run "ecto.migrate", args
  Mix.Task.run "ecto.dump"
end

from ecto_sql.

bgentry avatar bgentry commented on September 28, 2024

@josevalim brilliant idea, thanks! Explicit rejection of invalid args will help prevent others from running into this class of problem. And also, thanks for the solution 😄

from ecto_sql.

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.