Ecto.Migration.table
You're seeing just the function
table
, go back to Ecto.Migration module for more information.
Returns a table struct that can be given to create/2
, alter/2
, drop/1
,
etc.
Examples
create table("products") do
add :name, :string
add :price, :decimal
end
drop table("products")
create table("products", primary_key: false) do
add :name, :string
add :price, :decimal
end
Options
:primary_key
- whenfalse
, a primary key field is not generated on table creation.:engine
- customizes the table storage for supported databases. For MySQL, the default is InnoDB.:prefix
- the prefix for the table. This prefix will automatically be used for all constraints and references defined for this table unless explicitly overridden in said constraints/references.:options
- provide custom options that will be appended after the generated statement. For example, "WITH", "INHERITS", or "ON COMMIT" clauses.