20211110080001_create_all_vf_enums.exs (1801B)
1 # Zenflows is designed to implement the Valueflows vocabulary, 2 # written and maintained by srfsh <info@dyne.org>. 3 # Copyright (C) 2021-2023 Dyne.org foundation <foundation@dyne.org>. 4 # 5 # This program is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU Affero General Public License as published by 7 # the Free Software Foundation, either version 3 of the License, or 8 # (at your option) any later version. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Affero General Public License for more details. 14 # 15 # You should have received a copy of the GNU Affero General Public License 16 # along with this program. If not, see <https://www.gnu.org/licenses/>. 17 18 defmodule Zenflows.SQL.Repo.Migrations.Create_vf_enums do 19 # New enums can be added on top of these as anoter migration files. 20 # The point of this migration is to just prevent circular references. 21 use Ecto.Migration 22 23 @time_unit_up """ 24 CREATE TYPE vf_time_unit AS ENUM ( 25 'year', 26 'month', 27 'week', 28 'day', 29 'hour', 30 'minute', 31 'second' 32 ) 33 """ 34 @time_unit_down "DROP TYPE vf_time_unit" 35 36 @action_id_up """ 37 CREATE TYPE vf_action_id AS ENUM ( 38 'produce', 39 'raise', 40 'consume', 41 'lower', 42 'use', 43 'work', 44 'cite', 45 'deliverService', 46 'pickup', 'dropoff', 47 'accept', 'modify', 48 'combine', 'separate', 49 'transferAllRights', 50 'transferCustody', 51 'transfer', 52 'move' 53 ) 54 """ 55 @action_id_down "DROP TYPE vf_action_id" 56 57 @agent_type_up "CREATE TYPE vf_agent_type AS ENUM ('per', 'org')" 58 @agent_type_down "DROP TYPE vf_agent_type" 59 60 def change() do 61 execute @time_unit_up, @time_unit_down 62 execute @action_id_up, @action_id_down 63 execute @agent_type_up, @agent_type_down 64 end 65 end