Initial commit on Forgejo
All checks were successful
CI and deploy / Test (push) Successful in 4m52s
CI and deploy / Deploy production (push) Successful in 23s

Fresh repository history for elektrine/tarakan hosted at
https://git.elektrine.com/elektrine/tarakan.
This commit is contained in:
Maxfield Luke 2026-07-29 04:43:40 -04:00
commit af6077b9c3
455 changed files with 78366 additions and 0 deletions

View file

@ -0,0 +1,22 @@
defmodule Tarakan.Repo.Migrations.CreateVotes do
use Ecto.Migration
def change do
create table(:votes) do
add :account_id, references(:accounts, on_delete: :delete_all), null: false
# Polymorphic by (subject_type, subject_id): "finding" -> scan_findings,
# "comment" -> finding_comments. Kept generic so new votable kinds don't
# need a new table.
add :subject_type, :string, null: false
add :subject_id, :bigint, null: false
add :value, :integer, null: false
timestamps(type: :utc_datetime_usec)
end
# One standing vote per account per item; recasting updates value.
create unique_index(:votes, [:account_id, :subject_type, :subject_id])
create index(:votes, [:subject_type, :subject_id])
create constraint(:votes, :votes_value_must_be_unit, check: "value IN (-1, 1)")
end
end