487 B · text History 6ccfeee
defmodule OhMyExOhIrcd.Repo.Migrations.CreateScrobbles do
  use Ecto.Migration

  def change do
    create table(:scrobbles) do
      add :channel_id, references(:channels, on_delete: :delete_all), null: false
      add :who, :string, null: false
      add :artist, :string, null: false
      add :track, :string, null: false
      add :album, :string

      timestamps(type: :utc_datetime, updated_at: false)
    end

    create index(:scrobbles, [:channel_id, :inserted_at])
  end
end