phoenix-ecto: three columns
This commit is contained in:
parent
0fca0d17bd
commit
3e6c283be1
|
@ -6,14 +6,18 @@ tags: [WIP]
|
||||||
updated: 201708.29
|
updated: 201708.29
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Schemas
|
||||||
|
{: .-three-column}
|
||||||
|
|
||||||
### Generating
|
### Generating
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mix phx.gen.html Accounts Profile profiles email:string age:integer
|
$ mix phx.gen.html \
|
||||||
```
|
Accounts \ # domain
|
||||||
|
Profile \ # schema
|
||||||
```bash
|
profiles \ # table name
|
||||||
$ mix phx.gen.html Accounts User users email:string hashed_password:string
|
email:string \
|
||||||
|
age:integer
|
||||||
```
|
```
|
||||||
|
|
||||||
### Schema
|
### Schema
|
||||||
|
@ -25,9 +29,6 @@ defmodule Myapp.Accounts.User do
|
||||||
schema "users" do
|
schema "users" do
|
||||||
field :name
|
field :name
|
||||||
field :age, :integer
|
field :age, :integer
|
||||||
# :id :binary :integer :float :boolean :string :binary
|
|
||||||
# {:array, inner_type} :decimal :map
|
|
||||||
|
|
||||||
field :password, virtual: true
|
field :password, virtual: true
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
|
|
Loading…
Reference in New Issue