Skip to content
This repository has been archived by the owner on Oct 15, 2019. It is now read-only.

expanding the mix task to include Phoenix #1

Closed
niccolox opened this issue Nov 25, 2016 · 3 comments
Closed

expanding the mix task to include Phoenix #1

niccolox opened this issue Nov 25, 2016 · 3 comments

Comments

@niccolox
Copy link

niccolox commented Nov 25, 2016

hi there

this is a stub, am trying to work out how to go from a fully designed database, say an ER or other visualization of a complex database into ecto and then into Phoenix

parkerl/fishing_spot#2

looks like this mix task generates the models for ecto
https://github.com/alexandrubagu/ecto_generator/blob/master/lib/mix/tasks/ecto.dump.schema.ex

but what about Phoenix integration?
I assume the answer would be to fork this repo and merge it with a Phoenix generator for HTML or ?
https://github.com/phoenixframework/phoenix/blob/master/lib/mix/tasks/phoenix.gen.html.ex

leaving this as an open question for myself and others that my to come to this same issue

@niccolox
Copy link
Author

looking at this more, the gen model for phoenix is closer

https://github.com/phoenixframework/phoenix/blob/master/lib/mix/tasks/phoenix.gen.model.ex

am thinking that maybe a Phoenix.Gen.HTML could be modified to have a switch like "--use-schema-db=dbfile.sql" instead of the usual "Post posts title body"

and that there would be a conditional in the phoenix.gen.model or phoenix.gen.html to call this file instead

apologies if my terminology is poor, am new to Elixir / Phoenix

@alexandrubagu
Copy link
Owner

Hi there,
When I start this project I was thinking that will be merged into ecto, here's the pull request: elixir-ecto/ecto#1722

Basically you need to add this projects into you mix.exs deps, run mix deps.get and then you can ecto.dump.schema. Sometime you will need to edit generated files because sometime you can have indexes, other primary keys etc.

If you have better ideas pleasse open a pull request and I will be happy to discuss or implement new features. 👍 😄

@niccolox
Copy link
Author

ok, I am working on something inspired by this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants