For the complete documentation index, see llms.txt. This page is also available as Markdown.

sync_acpt_table

Synchronise the physical database table with the stored definition

Synchronise the physical database table with the stored definition.

Handles both cases automatically: creates the table from scratch when it does not exist yet, or applies the diff (ALTER / ADD / DROP statements) when it exists but is out of date. Returns true immediately when the table is already in sync. This is the preferred function for applying schema changes — use create_acpt_table() only when you need to explicitly control the action.

Usage

// Save the definition first, then sync
save_acpt_table([
    'name'       => 'products',
    'label'      => 'Products',
    'timestamps' => true,
    'columns'    => [
        ['name' => 'title', 'uiType' => 'Text'],
        ['name' => 'price', 'uiType' => 'Currency'],
    ],
]);

sync_acpt_table('products');

Parameters

Parameter
Type
Required
Description

tableName

string

Required

Machine name of the table

Return

Type
Description

bool

true on success or when the table is already in sync, false on error or when the table definition was not found

Last updated