ash_postgres/lib/check_constraint.ex

32 lines
815 B
Elixir
Raw Normal View History

defmodule AshPostgres.CheckConstraint do
@moduledoc """
Contains configuration for database check constraints
"""
defstruct [:attribute, :name, :message, :check]
def schema do
[
attribute: [
type: :any,
doc:
"The attribute or list of attributes to which an error will be added if the check constraint fails",
required: true
],
name: [
type: :string,
required: true,
doc: "The name of the constraint"
],
message: [
type: :string,
doc: "The message to be added if the check constraint fails"
],
check: [
type: :string,
doc:
"The contents of the check. If this is set, the migration generator will include it when generating migrations"
]
]
end
end