Skip to main content

Field Definitions Drive DB Schema

Define fields visually — generate database tables automatically.

What Does It Mean?

In JCB, every field you create in a View or Table isn't just for display — it's a direct instruction to the database compiler. The structure and rules you define in the GUI are translated into real database schema definitions, meaning the tables, columns, data types, and constraints are built dynamically and correctly with every compile.

Instead of manually creating SQL files or editing Joomla install/uninstall scripts, JCB lets you define everything through its GUI. These field definitions then drive the schema that your component relies on — making the process faster, more accurate, and easier to maintain.

Key Features

  • 🛠️ Visual Schema Modeling: Create and manage database structure entirely from JCB’s field interface — no SQL needed.
  • 📊 Field-to-Column Mapping: Each field becomes a column in the database table (or multiple if needed, e.g., language keys or repeaters).
  • ⚙️ Supports All Common Data Types: Define fields with types like:
    • INT, VARCHAR, TEXT
    • DATE, DATETIME, BOOLEAN
    • JSON, ENUM (via list fields)
    • Custom user-defined formats
  • 📏 Constraint Support: Set constraints per field:
    • Required / Nullable
    • Default Values
    • Unique Keys
    • Indexed columns
    • Length/Size limits
  • 🔄 Auto SQL File Generation: At compile time, JCB automatically generates:
    • install.mysql.utf8.sql
    • uninstall.sql
    • Update scripts (if enabled)
  • 🔍 Change Tracking: JCB tracks schema changes and optionally creates update files for safe migration between versions.
  • 🔧 Multi-Version Output: Compile for Joomla 3, 4, or 5 — with matching schema for each version.
  • 🧠 Round-Trip Compatible: Insert/Replace tags allow manual schema logic (e.g., triggers, views) without breaking future builds.

Use Cases

  • Create a new custom table with multilingual fields and access rules
  • Add a repeatable field (subform) and automatically generate relational tables
  • Modify an existing table by changing field constraints — JCB compiles the SQL accordingly
  • Build version-safe schema that supports upgrades from JCB-managed update servers

How to Use It

  1. Go to JCB → Admin Views.
  2. Add or edit a View.
  3. Define fields:
    • Choose field type (e.g. text, calendar, user, list)
    • Set database type and GUI rendering
    • Assign constraints (required, default, unique)
  4. On build, JCB will:
    • Generate correct schema in install.sql
    • Create uninstall instructions
    • Optionally create an update SQL file based on version difference

🧠 Tip: Use the Field Type System to standardize reusable DB structures across multiple tables or projects.

Conclusion

With field-driven schema generation, JCB turns component design into a visual, version-controlled experience. No more manual SQL. No mismatched install scripts. Just consistent, accurate, repeatable schema — built from your blueprint every time.