fix: fix type specification for foreign_key_names

This commit is contained in:
Zach Daniel 2023-10-10 15:47:53 -04:00
parent 5805f07d69
commit c6d71d74bf
2 changed files with 70 additions and 70 deletions

View file

@ -60,7 +60,7 @@ end
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The repo that will be used to fetch your data. See the `AshPostgres.Repo` documentation for more
@ -74,7 +74,7 @@ end
migrate?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -94,7 +94,7 @@ end
migration_types
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">Keyword.t</code>
@ -114,7 +114,7 @@ end
migration_defaults
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">Keyword.t</code>
@ -135,13 +135,13 @@ end
base_filter_sql
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
A raw sql version of the base_filter, e.g `representative = true`. Required if trying to create a unique constraint on a resource with a base_filter
@ -155,7 +155,7 @@ end
simple_join_first_aggregates
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list(atom)</code>
@ -176,7 +176,7 @@ end
skip_unique_indexes
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list(atom) | atom</code>
@ -196,7 +196,7 @@ end
unique_index_names
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list({list(atom), String.t} | {list(atom), String.t, String.t})</code>
@ -217,7 +217,7 @@ end
exclusion_constraint_names
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">`any`</code>
@ -238,7 +238,7 @@ end
identity_index_names
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">`any`</code>
@ -259,7 +259,7 @@ end
foreign_key_names
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list({atom, String.t} | {String.t, String.t})</code>
@ -280,7 +280,7 @@ end
migration_ignore_attributes
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list(atom)</code>
@ -301,13 +301,13 @@ end
table
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The table to store and read the resource from. If this is changed, the migration generator will not remove the old table.
@ -322,13 +322,13 @@ end
schema
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The schema that the table is located in. Schema-based multitenancy will supercede this option. If this is changed, the migration generator will not remove the old schema.
@ -343,7 +343,7 @@ end
polymorphic?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -421,13 +421,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
fields
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list(atom | String.t) | atom | String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The fields to include in the index.
@ -441,13 +441,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
name
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
the name of the index. Defaults to "#{table}_#{column}_index".
@ -461,7 +461,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
unique
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -481,7 +481,7 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
concurrently
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -501,13 +501,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
using
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
configures the index type.
@ -521,13 +521,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
prefix
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
specify an optional prefix for the index.
@ -541,13 +541,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
where
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
specify conditions for a partial index.
@ -561,13 +561,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
message
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
A custom message to use for unique indexes that have been violated
@ -581,13 +581,13 @@ index ["column", "column2"], unique: true, where: "thing = TRUE"
include
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">list(String.t)</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
specify fields for a covering index. This is not supported by all databases. For more information on PostgreSQL support, please read the official docs.
@ -688,7 +688,7 @@ end
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The name of the statement, must be unique within the resource
@ -710,7 +710,7 @@ end
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
How to create the structure of the statement
@ -732,7 +732,7 @@ end
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
How to tear down the structure of the statement
@ -746,7 +746,7 @@ end
code?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -817,7 +817,7 @@ end
<code class="inline">list(String.t | atom) | String.t | atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
A template that will cause the resource to create/manage the specified schema.
@ -832,7 +832,7 @@ end
create?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -852,7 +852,7 @@ end
update?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
@ -912,13 +912,13 @@ end
polymorphic_on_delete
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:delete | :nilify | :nothing | :restrict</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
For polymorphic resources, configures the on_delete behavior of the automatically generated foreign keys to source tables.
@ -932,13 +932,13 @@ end
polymorphic_on_update
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:update | :nilify | :nothing | :restrict</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
For polymorphic resources, configures the on_update behavior of the automatically generated foreign keys to source tables.
@ -952,13 +952,13 @@ end
polymorphic_name
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:update | :nilify | :nothing | :restrict</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
For polymorphic resources, configures the on_update behavior of the automatically generated foreign keys to source tables.
@ -1021,7 +1021,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
<code class="inline">atom</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The relationship to be configured
@ -1035,13 +1035,13 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
ignore?
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">boolean</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
If set to true, no reference is created for the given relationship. This is useful if you need to define it in some custom way
@ -1055,13 +1055,13 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
on_delete
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:delete | :nilify | :nothing | :restrict</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
What should happen to records of this resource when the referenced record of the *destination* resource is deleted.
@ -1076,13 +1076,13 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
on_update
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">:update | :nilify | :nothing | :restrict</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
What should happen to records of this resource when the referenced destination_attribute of the *destination* record is update.
@ -1097,7 +1097,7 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
deferrable
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">false | true | :initially</code>
@ -1118,13 +1118,13 @@ reference :post, on_delete: :delete, on_update: :update, name: "comments_to_post
name
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The name of the foreign key to generate in the database. Defaults to <table>_<source_attribute>_fkey
@ -1216,7 +1216,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
<code class="inline">`any`</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The attribute or list of attributes to which an error will be added if the check constraint fails
@ -1237,7 +1237,7 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The name of the constraint
@ -1251,13 +1251,13 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
message
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The message to be added if the check constraint fails
@ -1271,13 +1271,13 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
check
</span>
</a>
</td>
<td style="text-align: left">
<code class="inline">String.t</code>
</td>
<td style="text-align: left">
</td>
<td style="text-align: left" colspan=2>
The contents of the check. If this is set, the migration generator will include it when generating migrations
@ -1294,9 +1294,3 @@ check_constraint :price, "price_must_be_positive", check: "price > 0", message:
### Introspection
Target: `AshPostgres.CheckConstraint`

View file

@ -335,7 +335,13 @@ defmodule AshPostgres.DataLayer do
"""
],
foreign_key_names: [
type: {:list, {:or, [{:tuple, [:atom, :string]}, {:tuple, [:string, :string]}]}},
type:
{:list,
{:or,
[
{:tuple, [{:or, [:atom, :string]}, :string]},
{:tuple, [{:or, [:atom, :string]}, :string, :string]}
]}},
default: [],
doc: """
A list of foreign keys that could raise errors, or an mfa to a function that takes a changeset and returns a list. In the format: `{:key, "name_of_constraint"}` or `{:key, "name_of_constraint", "custom error message"}`