Skip to content

fix: demo extras seed completes on PostgreSQL - #407

Merged
navneetkumar-pim-webkul merged 5 commits into
unopim:masterfrom
dripar-webkul:fix/874-demo-seeder-pgsql-boolean-cast
May 26, 2026
Merged

navneetkumar-pim-webkul merged 5 commits into
unopim:masterfrom
dripar-webkul:fix/874-demo-seeder-pgsql-boolean-cast

Conversation

@dripar-webkul

Copy link
Copy Markdown
Collaborator

Summary

Fixesed Demo seed on pgsql failed in 3 stacked ways, leaving the dashboard half-populated:

  • int 0/1 into boolean columns → SQLSTATE 42804
  • FK triggers firing between dependent inserts → SQLSTATE 23503
  • setval(MAX(id)+1) on join tables (no id) and oauth_clients (uuid id) → SQLSTATE 42703 / 42883

Fix (all in DemoExtrasTableSeeder, Core helper untouched)

  • Cast int 0/1 → bool via Schema::getColumns
  • Bypass FK triggers per driver around the dump
  • Filter to integer-id tables before fixSequences
  • Re-throw on failure so partial state can't slip through

Test plan

  • Pest: boolean cast / FK bypass / sequence filter (14 tests)
  • Manual: unopim:install:demo-data on pgsql completes, dashboard full

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Unopim’s demo extras seeding so unopim:install:demo-data can complete on PostgreSQL by normalizing boolean payloads, temporarily bypassing FK enforcement during the dump replay, and preventing PostgreSQL sequence repair from running on tables that cannot support it.

Changes:

  • Add schema-driven casting of 0/1 integers to PHP booleans for boolean columns before inserting demo rows.
  • Add driver-specific FK/trigger bypass during demo dump application and ensure failures rethrow to avoid leaving partial demo state.
  • Filter the table list passed to DatabaseSequenceHelper::fixSequences() to only those whose id column is integer-like; add regression tests around these behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/Webkul/Installer/src/Database/Seeders/DemoExtrasTableSeeder.php Adds boolean casting, PostgreSQL FK/trigger bypass, sequence-table filtering, and rethrow-on-failure behavior.
packages/Webkul/Installer/tests/Unit/DemoExtrasBooleanCastTest.php Adds unit coverage for boolean casting behavior (int 0/1 → bool only on boolean columns).
packages/Webkul/Installer/tests/Unit/DemoExtrasPgsqlFkBypassTest.php Adds unit coverage asserting driver-specific FK/trigger bypass statements are emitted.
packages/Webkul/Installer/tests/Unit/DemoExtrasSequenceFilterTest.php Adds unit coverage for filtering out tables without integer id (e.g., join tables, UUID PKs).
packages/Webkul/AdminApi/tests/Feature/Catalog/ApiCategoryTest.php Makes locale selection deterministic (via orderBy('id')) in “all locales” category tests.

…-pgsql-boolean-cast

# Conflicts:
#	packages/Webkul/Installer/src/Database/Seeders/DemoExtrasTableSeeder.php
@dripar-webkul
dripar-webkul changed the base branch from master to 2.1 May 25, 2026 12:37
@dripar-webkul
dripar-webkul changed the base branch from 2.1 to master May 25, 2026 13:53
@navneetkumar-pim-webkul
navneetkumar-pim-webkul merged commit 94e98fa into unopim:master May 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants