2021-08-11 21:58:28 +00:00
|
|
|
defmodule Ketbin.Repo.Migrations.CreatePastes do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
2021-10-07 20:26:42 +00:00
|
|
|
create_if_not_exists table(:pastes, primary_key: false) do
|
2021-08-11 21:58:28 +00:00
|
|
|
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
|
|
|
|
|
2021-10-07 20:26:42 +00:00
|
|
|
create_if_not_exists index(:pastes, [:belongs_to])
|
2021-08-11 21:58:28 +00:00
|
|
|
end
|
|
|
|
end
|