20 lines
579 B
Elixir
20 lines
579 B
Elixir
defmodule Nulla.Repo.Migrations.CreateMediaAttachments do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:media_attachments, primary_key: false) do
|
|
add :id, :bigint, primary_key: true
|
|
add :type, :string, null: false
|
|
add :mediaType, :string, null: false
|
|
add :url, :string, null: false
|
|
add :name, :string
|
|
add :width, :integer
|
|
add :height, :integer
|
|
add :note_id, references(:notes, on_delete: :delete_all), null: false
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:media_attachments, [:note_id])
|
|
end
|
|
end
|