PhoenixKit.Migrations.Postgres.V17 (phoenix_kit v1.6.15)

View Source

PhoenixKit V17 Migration: Entities System (WordPress ACF-like)

This migration adds the dynamic entities system for creating custom content types with flexible field schemas, similar to WordPress Advanced Custom Fields (ACF). It also introduces display_name_plural to improve UI labelling for collections.

Changes

Entities Table (phoenix_kit_entities)

  • Stores entity type definitions (content type blueprints)
  • Includes singular and plural display names
  • JSONB fields_definition for flexible field schemas
  • JSONB settings for entity-specific configuration
  • Supports dynamic content types like blog posts, products, team members, etc.

Entity Data Table (phoenix_kit_entity_data)

  • Stores actual records based on entity blueprints
  • JSONB data column for field values
  • JSONB metadata for additional information
  • Generic columns for common fields (title, slug, status)

Settings Seeds

  • Inserts default entities-related settings (entities_enabled, etc.)

PostgreSQL Support

  • Leverages PostgreSQL's native JSONB data type
  • Supports prefix for schema isolation
  • Indexes on frequently queried columns
  • Foreign key relationships

Summary

Functions

Rollback the V17 migration.

Run the V17 migration to add the entities system.

Functions

down(opts)

Rollback the V17 migration.

up(opts)

Run the V17 migration to add the entities system.