ash_postgres/lib/check_constraint.ex

31 lines
825 B
Elixir
Raw Normal View History

defmodule AshPostgres.CheckConstraint do
2023-09-23 08:14:25 +12:00
@moduledoc "Represents a configured check constraint on the table backing a resource"
2022-08-24 11:56:46 +12:00
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