2020-07-30 00:49:51 +00:00
|
|
|
defmodule Wiki.Repo.Migrations.CreatePages do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:pages) do
|
|
|
|
add :title, :string
|
|
|
|
add :encrypted_content, :binary
|
|
|
|
add :encrypted_content_iv, :binary
|
|
|
|
add :encrypted_content_tag, :binary
|
2020-08-01 23:37:16 +00:00
|
|
|
add :encrypted_html, :binary
|
|
|
|
add :encrypted_html_iv, :binary
|
|
|
|
add :encrypted_html_tag, :binary
|
2020-08-01 20:43:55 +00:00
|
|
|
add :user_id, references(:users, on_delete: :delete_all)
|
2020-07-30 00:49:51 +00:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create index(:pages, [:user_id])
|
2020-08-01 23:37:16 +00:00
|
|
|
create unique_index(:pages, ["(lower(title))"], name: :pages_lowercase_title_index)
|
2020-07-30 00:49:51 +00:00
|
|
|
end
|
|
|
|
end
|