diff --git a/lib/decentralised_book_index/metadata/book.ex b/lib/decentralised_book_index/metadata/book.ex
index 387d97b..ae58a53 100644
--- a/lib/decentralised_book_index/metadata/book.ex
+++ b/lib/decentralised_book_index/metadata/book.ex
@@ -373,7 +373,6 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end
belongs_to :publisher, Metadata.Publisher do
- allow_nil? false
public? true
end
diff --git a/lib/decentralised_book_index_web/live/book_live/show.ex b/lib/decentralised_book_index_web/live/book_live/show.ex
index f1e8ee6..2d4bc95 100644
--- a/lib/decentralised_book_index_web/live/book_live/show.ex
+++ b/lib/decentralised_book_index_web/live/book_live/show.ex
@@ -64,12 +64,14 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
Description
{@book.description}
-
- - Publisher
- -
- {@book.publisher.name}
-
-
+ <%= if not is_nil(@book.publisher) do %>
+
+ - Publisher
+ -
+ {@book.publisher.name}
+
+
+ <% end %>
- Published
- {@book.published}
diff --git a/priv/repo/migrations/20250603150057_update_to_allow_a_book_to_have_no_publisher.exs b/priv/repo/migrations/20250603150057_update_to_allow_a_book_to_have_no_publisher.exs
new file mode 100644
index 0000000..40ed13d
--- /dev/null
+++ b/priv/repo/migrations/20250603150057_update_to_allow_a_book_to_have_no_publisher.exs
@@ -0,0 +1,21 @@
+defmodule DecentralisedBookIndex.Repo.Migrations.UpdateToAllowABookToHaveNoPublisher do
+ @moduledoc """
+ Updates resources based on their most recent snapshots.
+
+ This file was autogenerated with `mix ash_postgres.generate_migrations`
+ """
+
+ use Ecto.Migration
+
+ def up do
+ alter table(:books) do
+ modify :publisher_id, :uuid, null: true
+ end
+ end
+
+ def down do
+ alter table(:books) do
+ modify :publisher_id, :uuid, null: false
+ end
+ end
+end
diff --git a/priv/resource_snapshots/repo/books/20250603150057.json b/priv/resource_snapshots/repo/books/20250603150057.json
new file mode 100644
index 0000000..37434a7
--- /dev/null
+++ b/priv/resource_snapshots/repo/books/20250603150057.json
@@ -0,0 +1,227 @@
+{
+ "attributes": [
+ {
+ "allow_nil?": false,
+ "default": "fragment(\"gen_random_uuid()\")",
+ "generated?": false,
+ "primary_key?": true,
+ "references": null,
+ "size": null,
+ "source": "id",
+ "type": "uuid"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "title",
+ "type": "text"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "description",
+ "type": "text"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "published",
+ "type": "date"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "language",
+ "type": "text"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "format",
+ "type": "text"
+ },
+ {
+ "allow_nil?": false,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "page_count",
+ "type": "bigint"
+ },
+ {
+ "allow_nil?": true,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "cover_image_url",
+ "type": "text"
+ },
+ {
+ "allow_nil?": false,
+ "default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "inserted_at",
+ "type": "utc_datetime_usec"
+ },
+ {
+ "allow_nil?": false,
+ "default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
+ "generated?": false,
+ "primary_key?": false,
+ "references": null,
+ "size": null,
+ "source": "updated_at",
+ "type": "utc_datetime_usec"
+ },
+ {
+ "allow_nil?": true,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": {
+ "deferrable": false,
+ "destination_attribute": "id",
+ "destination_attribute_default": null,
+ "destination_attribute_generated": null,
+ "index?": false,
+ "match_type": null,
+ "match_with": null,
+ "multitenancy": {
+ "attribute": null,
+ "global": null,
+ "strategy": null
+ },
+ "name": "books_dbi_server_id_fkey",
+ "on_delete": null,
+ "on_update": null,
+ "primary_key?": true,
+ "schema": "public",
+ "table": "dbi_servers"
+ },
+ "size": null,
+ "source": "dbi_server_id",
+ "type": "uuid"
+ },
+ {
+ "allow_nil?": true,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": {
+ "deferrable": false,
+ "destination_attribute": "id",
+ "destination_attribute_default": null,
+ "destination_attribute_generated": null,
+ "index?": false,
+ "match_type": null,
+ "match_with": null,
+ "multitenancy": {
+ "attribute": null,
+ "global": null,
+ "strategy": null
+ },
+ "name": "books_book_editions_registry_id_fkey",
+ "on_delete": null,
+ "on_update": null,
+ "primary_key?": true,
+ "schema": "public",
+ "table": "book_editions_registries"
+ },
+ "size": null,
+ "source": "book_editions_registry_id",
+ "type": "uuid"
+ },
+ {
+ "allow_nil?": true,
+ "default": "nil",
+ "generated?": false,
+ "primary_key?": false,
+ "references": {
+ "deferrable": false,
+ "destination_attribute": "id",
+ "destination_attribute_default": null,
+ "destination_attribute_generated": null,
+ "index?": false,
+ "match_type": null,
+ "match_with": null,
+ "multitenancy": {
+ "attribute": null,
+ "global": null,
+ "strategy": null
+ },
+ "name": "books_publisher_id_fkey",
+ "on_delete": null,
+ "on_update": null,
+ "primary_key?": true,
+ "schema": "public",
+ "table": "publishers"
+ },
+ "size": null,
+ "source": "publisher_id",
+ "type": "uuid"
+ }
+ ],
+ "base_filter": null,
+ "check_constraints": [],
+ "custom_indexes": [
+ {
+ "all_tenants?": false,
+ "concurrently": false,
+ "error_fields": [],
+ "fields": [
+ {
+ "type": "string",
+ "value": "title gin_trgm_ops"
+ }
+ ],
+ "include": null,
+ "message": null,
+ "name": "book_title_gin_index",
+ "nulls_distinct": true,
+ "prefix": null,
+ "table": null,
+ "unique": false,
+ "using": "GIN",
+ "where": null
+ }
+ ],
+ "custom_statements": [],
+ "has_create_action": true,
+ "hash": "AA67DC03E5D78606517F268BD28B58521F2000DE3BA531FA48363CCD08CE4475",
+ "identities": [],
+ "multitenancy": {
+ "attribute": null,
+ "global": null,
+ "strategy": null
+ },
+ "repo": "Elixir.DecentralisedBookIndex.Repo",
+ "schema": null,
+ "table": "books"
+}
\ No newline at end of file