A secret Phoenix app.
- Run
mix setup
to install and setup dependencies mix ecto.migrate
to setup databasemix run priv/repo/seeds.exs
to seed the database. (See "Seeds" below)- Start Phoenix endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
mix phx.gen.schema User users name:string email:string
to generate a schema and migration.
mix ecto.gen.migration add_foo
to generate a migration only
To run migrations mix ecto.migrate
To rollback mix ecto.rollback --step 1
Copy priv/repo/seeds/accounts.example.json
to priv/repo/seeds/accounts.json
and populate with real sead data.
mix run priv/repo/seeds.exs
to seed the database
"Contexts are dedicated modules that expose and group related functionality"
To generate entire scaffolding, including views, controllers and schema mix phx.gen.html FooContext BarResource bar_resources some_attribute:string
The --no-context
and --no-schema
flags can be passed to prevent creating those files, if needed.
mix phx.gen.context
can be used if you don't need web resources. --no-schema
can be used if you don't want the schema.
iex -S mix
to start a session
Synthesizer.Repo.all(Synthesizer.Account)
is an example query. Aliases can be setup so not everything needs to be preceeded by the module name
recompile()
if you change code and don't want to start a new session
mix format mix.exs "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}"