mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
31 lines
815 B
Elixir
31 lines
815 B
Elixir
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
|