Ecto.migrate dont work on Umbrella Phoenix 1.3.0.rc.2

I’m using phoenix 1.3 with the umbrella tag, I have run this mix command to make the ecto schema:

mix phx.gen.schema Movie.movie movie_movies web_id:integer image:string name:string ori_name:string category:integer episodes:integer status:integer launch:date end:date broadcast:naive_datetime source:integer duration:time premier_temp:integer premier_year:integer

it generates without a problem, the schema files and migration file, but when I run ´mix ecto.migrate´ I get this:

21:07:12.507 [info]  Already up

But when I see the database with navicat I just have a table empty called “schema_migrations”, I have run the mix ecto.migrate on every apps folder and main folder but still without work, is this a bug or my fault?

PD: I just run the schema command and after the mix ecto.migrate, I dont modify the files generated in any moment

What does your priv\repo\migrations directory structure look like?

Sure @fattenap here is it:

I think I can see your problem. Your migrations (and I assume also the schemas) sit in the _web app. And, apparently, you used the new mix phx.new --umbrella generator that generates the main app, and _web app.

I think you ran the mix phx.gen.schema inside _web app. Which generated the files there. But this _web app has no Repo. Repo is inside the other, main app.

Unfortunately, the mix phx.gen.schema does not seem to work from within the main app (I think it probably will in final veersion of Phoenix 1.3). Which probably leaves you with only option to move the migrations and schema files to the main application, from _web application

1 Like

You’re right! :smiley: I just move the migration file and run over the root folder and thats it works!

But I think its a kind of problem/bug, is pretty boring every time you generate a schema/migration move the files, hope can be solved :slight_smile:

Just a question… I also need to move the schema and controllers to the main app? Oo

Anyway so many thanks!

I think the convention would be to leave controller in the _web app, along with all the webby stuff like: assets, views, templates and channels.

You would most likely want to move schema, and make sure it’s not namespaced under Foo.Web but Foo, i.e. rename Foo.Web.Movie to Foo.Movie if this is needed.

I do agree it is a problem/bug, most likely it’s not a finished feature.

2 Likes

All right! Thanks :smiley:

I don’t know if open a issue on phoenix repository at github, it involves the ecto command too, so I keep the post unsolved until its fixed ^^

@chrismccord this is known issue, right?

new error!, after move the migration to the main app, I run other few command to create schemas, this commands create a folder inside the web app, with the complete route example:

This is 100% a bug, I will not use umbrella for the moment… its pretty bug actually

-_- well it also happend on a normal phoenix project, I don’t know if its my computer (I create the new project on an new empty folder), I run schema command and it generate all the path on the folder…

It happend with the json command etc…

PD: I don’t know what happend before the schema command was working fine…

Can someone else reproduce this issue on Windows? :slight_smile:

Hello, @WolfDan did you managed to generate context too? read this Generating schemas with phx.gen.{context, json, html} and Contextual schema VS out-of-context schema (in Phoenix 1.3)
Also, when you run your app in umbrella’s flag (following this proof of concept phoenix is not your application), you have to move your migrations and the schema in the “domain” part (witch is managed by pure elixir) not in the “web interface” part, As @hubertlepicki explained.