mirror of
https://github.com/fly-apps/live_beats.git
synced 2025-01-11 07:45:25 +00:00
24 lines
676 B
Elixir
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
|