Skip to content

Instantly share code, notes, and snippets.

@abadongutierrez
Last active June 9, 2017 03:32
Show Gist options
  • Save abadongutierrez/c89aaa0efd9ef0c5ef36d40055e99614 to your computer and use it in GitHub Desktop.
Save abadongutierrez/c89aaa0efd9ef0c5ef36d40055e99614 to your computer and use it in GitHub Desktop.
defmodule Ecto101MigrationsSchemas.Repo.Migrations.EmployeeTable do
use Ecto.Migration
def change do
create table(:employee) do
add :first_name, :text, null: false
add :last_name, :text, null: false
add :hire_date, :date, null: false
add :department_id,
references(:department,
on_delete: :delete_all,
on_update: :update_all),
null: false
timestamps()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment