tarakan/priv/repo/migrations/20260711020036_bound_scan_finding_lines.exs
Maxfield Luke af6077b9c3
All checks were successful
CI and deploy / Test (push) Successful in 4m52s
CI and deploy / Deploy production (push) Successful in 23s
Initial commit on Forgejo
Fresh repository history for elektrine/tarakan hosted at
https://git.elektrine.com/elektrine/tarakan.
2026-07-29 04:43:40 -04:00

24 lines
810 B
Elixir

defmodule Tarakan.Repo.Migrations.BoundScanFindingLines do
use Ecto.Migration
def up do
drop constraint(:scan_findings, :scan_findings_lines_must_be_ordered)
create constraint(:scan_findings, :scan_findings_lines_must_be_ordered,
check:
"(line_start IS NULL AND line_end IS NULL) OR " <>
"(line_start BETWEEN 1 AND 1000000 AND " <>
"line_end BETWEEN line_start AND 1000000)"
)
end
def down do
drop constraint(:scan_findings, :scan_findings_lines_must_be_ordered)
create constraint(:scan_findings, :scan_findings_lines_must_be_ordered,
check:
"(line_start IS NULL) OR " <>
"(line_start >= 1 AND (line_end IS NULL OR line_end >= line_start))"
)
end
end