Custom tables are real database tables that you design in the admin panel. Use them to store whatever your site needs beyond pages and products: projects, bookings, listings or tasks.
A custom table is a real table in your project's database. You decide its name and its columns, and XFORG creates it for you.
Pages and forms never read a table directly. Data moves through three pieces that work together: a custom query reads or writes the table, a function runs the query, and the page shows what the function returns.
Every table already has an id, a uuid and a creation date. You do not add them yourself.
You add your own columns in the table editor.
Queries, functions and page events carry the data to your pages.
1
Open Custom Tables
In the admin panel, go to Database, then Custom Tables.
2
Click Create New Table
A window opens with two names to fill in.
3
Friendly Table Name
The name shown across the admin panel, for example Project Tasks.
4
Database Table Name
Lowercase letters, numbers and underscores only. The table is created with the ct_ prefix, so project_tasks becomes ct_project_tasks.
5
Add columns
A blank table with no columns is created. Click Edit Table and open the Table Structure tab to define its columns.
The database table name cannot be changed after creation. The friendly name can.
Open a table with Edit Table. The General configuration tab holds its names and its subscription settings.
Friendly Table Name
Shown across the admin panel. You can rename it at any time.
Database Table Name
Shown for reference. It is fixed after creation.
Enable row subscriptions
Lets each row of this table be billed on its own, for example one subscription per project.
Subscription
Which subscription the rows of this table use.
Owner field
The relationship column that says which user owns a row. Only that user can subscribe or manage the row.
Row subscriptions only store settings. No columns are added to your table. If the Owner field list is empty, add a relationship column that points at users first.
The Custom Tables list shows each table's name, status and creation date. Use Deactivate and Activate to change a table's status.
Deactivating a table does not stop functions from running queries against it. To control who can read or write the data, use the Security tab of each custom query.
A few decisions are easier to make before the table fills up.
Changes to a table's structure run on your live database as soon as you save. There is no staging copy.
Plan the columns you need before data arrives. Removing a column later also removes its data.
If each row belongs to a user, add a relationship column pointing at users from the start. Row subscriptions and owner checks both depend on it.
Use a row's uuid, not its id, whenever you identify a row in a link or a later query.