2018-01-13 22:33:03 +00:00
|
|
|
defmodule Eventos.Repo.Migrations.CreateEvents do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:events) do
|
|
|
|
add :title, :string, null: false
|
|
|
|
add :slug, :string, null: false
|
|
|
|
add :description, :string, null: true
|
|
|
|
add :begins_on, :datetimetz
|
|
|
|
add :ends_on, :datetimetz
|
|
|
|
add :geom, :geometry
|
|
|
|
add :state, :integer, null: false
|
|
|
|
add :public, :boolean, null: false
|
2018-01-15 10:50:26 +00:00
|
|
|
add :status, :integer, null: false
|
2018-01-13 22:33:03 +00:00
|
|
|
add :large_image, :string
|
|
|
|
add :thumbnail, :string
|
|
|
|
add :publish_at, :datetimetz
|
2018-01-16 18:45:09 +00:00
|
|
|
add :organizer_account_id, references(:accounts, on_delete: :nothing)
|
|
|
|
add :organizer_group_id, references(:groups, on_delete: :nothing)
|
2018-01-15 11:04:09 +00:00
|
|
|
add :category_id, references(:categories, on_delete: :nothing), null: false
|
2018-01-13 22:33:03 +00:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
2018-01-16 18:45:09 +00:00
|
|
|
create index(:events, [:organizer_account_id])
|
|
|
|
create index(:events, [:organizer_group_id])
|
2018-01-13 22:33:03 +00:00
|
|
|
create unique_index(:events, [:slug])
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|