Phoenix v1.3.0-rc.2 Mix.Tasks.Phx.Gen.Embedded
Generates an embedded Ecto schema for casting/validating data outside the DB.
mix phx.gen.embedded Blog.Post blog_posts title:string views:integer
The first argument is the schema module followed by its plural name (used as the table name).
The generated schema above will contain:
- an embedded schema file in lib/my_app/blog/post.ex.
Attributes
The resource fields are given using name:type
syntax
where type are the types supported by Ecto. Omitting
the type makes it default to :string
:
mix phx.gen.embedded Blog.Post blog_posts title views:integer
The following types are supported:
:integer
:float
:decimal
:boolean
:map
:string
:array
:references
:text
:date
:time
:naive_datetime
:utc_datetime
:uuid
:binary
:datetime
- An alias for:naive_datetime
Summary
Functions
A task needs to implement run
which receives
a list of command line args
Functions
A task needs to implement run
which receives
a list of command line args.
Callback implementation for Mix.Task.run/1
.