zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit f92b70c193a2de2f65bf836ec3fb8325240d3c48
parent 2a03b3d5e9151d4bbce1fa0abcf6c5195b8269f2
Author: srfsh <dev@srf.sh>
Date:   Thu,  8 Dec 2022 16:54:23 +0300

mig: use two separate fields instead of EventOrCommitment for satisfactions

Diffstat:
Mpriv/repo/migrations/20211115103758_fill_vf_satisfaction.exs | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/priv/repo/migrations/20211115103758_fill_vf_satisfaction.exs b/priv/repo/migrations/20211115103758_fill_vf_satisfaction.exs @@ -18,10 +18,17 @@ defmodule Zenflows.DB.Repo.Migrations.Fill_vf_satisfaction do use Ecto.Migration +@mutex """ +satisfied_by_event_id IS NOT NULL +OR +satisfied_by_commitment IS NOT NULL +""" + def change() do alter table("vf_satisfaction") do add :satisfies_id, references("vf_intent"), null: false - add :satisfied_by_id, references("vf_event_or_commitment"), null: false + add :satisfied_by_event_id, references("vf_economic_event") + add :satisfied_by_commitment_id, references("vf_commitment") add :resource_quantity_has_unit_id, references("vf_unit") add :resource_quantity_has_numerical_value, :decimal add :effort_quantity_has_unit_id, references("vf_unit") @@ -29,5 +36,6 @@ def change() do add :note, :text timestamps() end + create constraint("vf_satisfaction", :mutex, check: @mutex) end end