Packages

An open source two way communication platform for the social sector

Current section

Files

Jump to
glific priv repo migrations 20220125085553_create_organization_data_table.exs
Raw

priv/repo/migrations/20220125085553_create_organization_data_table.exs

defmodule Glific.Repo.Migrations.CreateOrganizationDataTable do
use Ecto.Migration
def change do
organization_data_table()
end
def organization_data_table do
create table(:organization_data) do
add(:key, :string, null: false)
add(:description, :string)
add(:json, :map, default: %{})
add(:text, :text)
# foreign key to organization restricting scope of this table to this organization only
add(:organization_id, references(:organizations, on_delete: :delete_all),
null: false,
comment: "Unique organization ID"
)
timestamps(type: :utc_datetime)
end
end
end