Fresh repository history for elektrine/tarakan hosted at https://git.elektrine.com/elektrine/tarakan.
23 lines
868 B
Elixir
23 lines
868 B
Elixir
defmodule Tarakan.Repo.Migrations.CreateInfestationSwarms do
|
|
use Ecto.Migration
|
|
|
|
# One row per swarm run. The cooldown reads the newest row for a pattern, and
|
|
# the rows double as a record of who fanned work out across other people's
|
|
# agents - the cost of a swarm lands on them, not on the moderator clicking.
|
|
def change do
|
|
create table(:infestation_swarms) do
|
|
add :pattern_key, :string, null: false
|
|
add :account_id, references(:accounts, on_delete: :nilify_all)
|
|
add :jobs_opened, :integer, null: false, default: 0
|
|
add :candidates_seen, :integer, null: false, default: 0
|
|
|
|
timestamps(type: :utc_datetime_usec)
|
|
end
|
|
|
|
create index(:infestation_swarms, [:pattern_key, :inserted_at],
|
|
name: :infestation_swarms_pattern_recent_index
|
|
)
|
|
|
|
create index(:infestation_swarms, [:account_id])
|
|
end
|
|
end
|