Created
September 26, 2016 15:16
-
-
Save radzserg/146330d7eca8e683b337f4d21c53309b to your computer and use it in GitHub Desktop.
Migration for image model.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule App.Repo.Migrations.CreateImage do | |
use Ecto.Migration | |
def change do | |
create table(:images) do | |
add :type, :string, null: false | |
add :path, :string, null: false | |
add :mime, :string | |
add :size, :integer | |
add :width, :integer | |
add :height, :integer | |
add :parent_id, references(:images, on_delete: :nothing) | |
timestamps() | |
end | |
create index(:images, [:parent_id]) | |
create index(:images, [:parent_id, :width, :height]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment