From b00dcf20c94a9ba396e4d3d423f5c6bb6cb39193 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Fri, 22 Sep 2023 17:16:47 -0400 Subject: [PATCH] chore: format & fix docs --- documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd | 4 ++-- lib/data_layer.ex | 5 ++++- mix.exs | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd b/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd index 4cc4e57..cdde5ed 100644 --- a/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd +++ b/documentation/dsls/DSL:-AshPostgres.DataLayer.cheatmd @@ -41,10 +41,10 @@ end | `base_filter_sql` | `String.t` | | 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 | | `simple_join_first_aggregates` | `list(atom)` | `[]` | A list of `:first` type aggregate names that can be joined to using a simple join. Use when you have a `:first` aggregate that uses a to-many relationship , but your `filter` statement ensures that there is only one result. Optimizes the generated query. | | `skip_unique_indexes` | `list(atom) \| atom` | `false` | Skip generating unique indexes when generating migrations | -| `unique_index_names` | `{list(atom), String.t} \| {list(atom), String.t, String.t}` | `[]` | A list of unique index names that could raise errors that are not configured in identities, or an mfa to a function that takes a changeset and returns the list. In the format `{[:affected, :keys], "name_of_constraint"}` or `{[:affected, :keys], "name_of_constraint", "custom error message"}` | +| `unique_index_names` | `list({list(atom), String.t} \| {list(atom), String.t, String.t})` | `[]` | A list of unique index names that could raise errors that are not configured in identities, or an mfa to a function that takes a changeset and returns the list. In the format `{[:affected, :keys], "name_of_constraint"}` or `{[:affected, :keys], "name_of_constraint", "custom error message"}` | | `exclusion_constraint_names` | ``any`` | `[]` | A list of exclusion constraint names that could raise errors. Must be in the format `{:affected_key, "name_of_constraint"}` or `{:affected_key, "name_of_constraint", "custom error message"}` | | `identity_index_names` | ``any`` | `[]` | A keyword list of identity names to the unique index name that they should use when being managed by the migration generator. | -| `foreign_key_names` | `{atom, String.t} \| {String.t, String.t}` | `[]` | 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"}` | +| `foreign_key_names` | `list({atom, String.t} \| {String.t, String.t})` | `[]` | 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"}` | | `migration_ignore_attributes` | `list(atom)` | `[]` | A list of attributes that will be ignored when generating migrations. | | `table` | `String.t` | | The table to store and read the resource from. If this is changed, the migration generator will not remove the old table. | | `schema` | `String.t` | | 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. | diff --git a/lib/data_layer.ex b/lib/data_layer.ex index 4fd22b3..0c50b5d 100644 --- a/lib/data_layer.ex +++ b/lib/data_layer.ex @@ -311,7 +311,10 @@ defmodule AshPostgres.DataLayer do doc: "Skip generating unique indexes when generating migrations" ], unique_index_names: [ - type: {:list, {:or, [{:tuple, [{:list, :atom}, :string]}, {:tuple, [{:list, :atom}, :string, :string]}]}}, + type: + {:list, + {:or, + [{:tuple, [{:list, :atom}, :string]}, {:tuple, [{:list, :atom}, :string, :string]}]}}, default: [], doc: """ A list of unique index names that could raise errors that are not configured in identities, or an mfa to a function that takes a changeset and returns the list. In the format `{[:affected, :keys], "name_of_constraint"}` or `{[:affected, :keys], "name_of_constraint", "custom error message"}` diff --git a/mix.exs b/mix.exs index 1593397..12a4d99 100644 --- a/mix.exs +++ b/mix.exs @@ -158,7 +158,7 @@ defmodule AshPostgres.MixProject do AshPostgres.Tsvector ], Extensions: [ - AshPostgres.Extensions.Vector, + AshPostgres.Extensions.Vector ], "Custom Aggregates": [ AshPostgres.CustomAggregate @@ -229,7 +229,8 @@ defmodule AshPostgres.MixProject do ], "spark.formatter": "spark.formatter --extensions AshPostgres.DataLayer", "spark.cheat_sheets": "spark.cheat_sheets --extensions AshPostgres.DataLayer", - "spark.cheat_sheets_in_search": "spark.cheat_sheets_in_search --extensions AshPostgres.DataLayer", + "spark.cheat_sheets_in_search": + "spark.cheat_sheets_in_search --extensions AshPostgres.DataLayer", "test.generate_migrations": "ash_postgres.generate_migrations", "test.check_migrations": "ash_postgres.generate_migrations --check", "test.migrate_tenants": "ash_postgres.migrate --tenants",