katbin/priv/repo/migrations/20210811213141_create_pastes.exs
SphericalKat 3f424a41c1
chore: migrate to prod
Signed-off-by: SphericalKat <amolele@gmail.com>
2021-10-08 01:56:42 +05:30

15 lines
428 B
Elixir

defmodule Ketbin.Repo.Migrations.CreatePastes do
use Ecto.Migration
def change do
create_if_not_exists table(:pastes, primary_key: false) do
add :id, :string, primary_key: true
add :is_url, :boolean, default: false, null: false
add :content, :text, null: false
add :belongs_to, references(:users, on_delete: :delete_all)
end
create_if_not_exists index(:pastes, [:belongs_to])
end
end