mirror of
https://github.com/fly-apps/live_beats.git
synced 2024-06-02 21:49:34 +00:00
23 lines
614 B
Elixir
23 lines
614 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 :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
|