live_beats/priv/repo/migrations/20211027201102_create_songs.exs
2021-11-01 15:57:53 -04:00

24 lines
676 B
Elixir

defmodule LiveBeats.Repo.Migrations.CreateSongs do
use Ecto.Migration
def change do
create table(:songs) do
add :album_artist, :string
add :artist, :string
add :duration, :integer
add :title, :string
add :mp3_path, :string
add :mp3_filename, :string
add :date_recorded, :naive_datetime
add :date_released, :naive_datetime
add :user_id, references(:users, on_delete: :nothing)
add :genre_id, references(:genres, on_delete: :nothing)
timestamps()
end
create unique_index(:songs, [:user_id, :title, :artist])
create index(:songs, [:user_id])
create index(:songs, [:genre_id])
end
end