Parsware
All articles

Model-driven apps

What happens when you save a table

In Parsware, saving a table is applying it. The database table and its columns exist before the screen comes back, a form and a view come with it, and a change that would cut stored data short is refused.

The Equipment Loan table in dark mode with its Edit field drawer open, refusing to shorten Tag Number to 20 because some records hold longer values, next to the title "What happens when you save a table"

There is no Publish button in Parsware's table designer. Saving is applying. Create a table and its database table exists before the screen comes back. Add a field and its column exists. Nothing is staged and nothing is waiting: what you see under Tables is what's in the database.

This article follows one new table from its first save, and shows the one change the platform refuses. We used our own unmanaged solution in a development environment. Every picture is the real product.

Create the table

In your solution, open Tables and press New. We're tracking kit lent out for a day, so the table is Equipment Loan:

The New table drawer: Display name Equipment Loan, Logical name con_ plus equipmentloan, Plural display name Equipment Loans, Icon No icon

The logical name starts with your publisher's prefix, con_ here, and it is what everything else uses to refer to the table.

Press Save. Three things happen before the designer opens:

  1. The definition is checked against the platform's table schema. It is the same check whether the definition came from this drawer, an imported solution or the AI assistant.
  2. The database table is created in this environment's own schema, with the platform's system columns (id, the created and modified stamps, owner, state) and a column for the primary field.
  3. A form and a view are created: an Information form and an All Equipment Loans view, each holding the primary field, so the table can go into an app straight away.

Only this environment is touched. Test and production get the table when you import the solution there, never on their own.

Add fields

We added a Tag Number (text, up to 40 characters), a Due Back date and an Asset lookup to the Asset table. Each Save in the field drawer adds the column there and then. The lookup also gets a real foreign key, so a loan can't point at an asset that doesn't exist.

The Fields list of Equipment Loan: Name (primary) Text, Asset Lookup to con_asset, Due Back Date/time, Tag Number Text

The form and view don't grow on their own

Open the Information form now and it still holds only Name:

The Form Designer for the new Information form: one General section with only Name in it, and Asset, Due Back and Tag Number waiting under Available fields

The form and the view are made once, when the table is created. A field added later exists, and its column exists, but nobody sees it until you drag it onto the form and into the view. That is on purpose: a form somebody has laid out shouldn't change under them every time a field is added. We dragged the three new fields under Name and saved.

What you can't change later

Open a field you've already saved:

The Edit field drawer for Tag Number: Logical name and Data type are greyed out, with the note that a field's name, type and what it points at cannot change; Max length 40 is still editable, with the note that making it shorter fails if a record holds a longer value

The logical name, the data type and, for a lookup, what it points at are fixed. Forms, views, scripts and other solutions refer to the field by name, and its column already holds data of one type. To change one, delete the field and add a new one.

The display name, required, the default control and the size can all still change.

Resizing changes a real column

Because the column exists, a text field's Max length is the column's length. We added Equipment Loans to the Asset Tracker app and lent out a laptop with the tag LOAN-2026-0001-LEEDS-HQ-3F, which is 26 characters:

The new loan in the app: Equipment Loan - ThinkPad for the Leeds workshop, with Name and Tag Number LOAN-2026-0001-LEEDS-HQ-3F

Making Tag Number longer always works. Making it shorter than something already stored is refused, and the field keeps its size:

The Edit field drawer with Max length 20 and the message: Some records already hold a value in 'Tag Number' that does not fit the new size. Nothing was changed: keep the current size, or change those values first.

To shorten it, first edit the records with the longer values, then save the new size.

This is a fix we made while writing this article. The drawer and the help page already promised the refusal, but the platform shortened the column anyway, cut our tag to its first 20 characters and said Saved successfully. The database was asked to convert each value explicitly, and an explicit conversion to a shorter text quietly truncates. It now converts the normal way, which refuses, and the message names the field and says nothing changed, in every language the product speaks.

What the database receives

You never write SQL in Parsware, but it helps to see once what a save turns into. Saving Equipment Loan and its three fields creates, in this environment's own schema, a table shaped like this:

CREATE TABLE con_equipmentloan (
    id              uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    created_at_utc  timestamptz NOT NULL DEFAULT now(),
    updated_at_utc  timestamptz NULL,
    row_version     bigint NOT NULL DEFAULT 1,
    created_by      uuid NULL,
    modified_by     uuid NULL,
    owner_type      smallint NULL,
    owner_id        uuid NULL,
    owning_unit     uuid NULL,
    -- … state and reason …
    con_name        varchar(200),
    con_tagnumber   varchar(40),
    con_dueback     timestamptz,
    con_asset       uuid REFERENCES con_asset (id)
);

Every row of that is something an earlier article explained. The stamps are who created or changed a record. row_version is what keeps two people from overwriting each other. The owner columns decide whose records you see. And con_asset has a real foreign key, which is why a loan can't point at an asset that doesn't exist, and why an asset that still has loans can't be deleted. Relationships between tables shows that refusal.

Each field's column has a type that matches it: varchar(40) for a 40-character text, timestamptz for a date. Every field type, explained lists them all.

One environment at a time

The table is created in the environment you are working in, inside its own database schema, and nowhere else. That is the reason environments are worth having: Development can have a half-finished table while Production carries on undisturbed.

Getting the table to Test and Production is a separate, deliberate step. Export the solution, import it there, and the import applies the same changes to that one environment's schema: creating tables, adding columns, widening text. Two environments are never changed by one save, and nothing is synchronised behind your back. Moving work from Dev to Test to Prod walks through it, and Environments that are actually separate explains the schemas.

What changes freely, and what doesn't

Every setting of a table or field falls into one of three groups. Knowing which before you save saves a rebuild later.

Group Settings Why
Free to change at any time Display names, plural, icon, description, required, default control, date format, auditing They describe how the field is shown, not what the column holds
Changeable, with a check Max length of text, precision of a decimal The column is altered; a change that would not fit stored values is refused
Fixed once saved Logical name, data type, what a lookup points at Everything refers to the name, and the column holds data of one type

The middle group is where the fix in this article lives. Widening is always safe; narrowing is checked against the data, and refused with the field named if any record would not fit.

Deleting a field

Deleting a field removes its column, and every value in it with it. There is no recycle bin, because a column dropped from a table is gone. Before deleting a field that has been in use, look at a view with the field as a column and decide whether anything in it needs keeping somewhere else first.

Forms, views, rules and reports refer to a field by its logical name, so check which of them use it before you delete it, and take it out of them first. A form or view is checked against its table every time it is saved, so one that still names the deleted field won't save until the field is taken out of it. Deleting a whole table is guarded more strictly, because so much more depends on it: Delete a table safely shows the list of what still depends on it.

Why no Publish button

Some platforms keep your changes as drafts and apply them all when you press Publish. Parsware applies each save as it happens. The reasons are practical:

  • What you see is what is there. The Fields list never shows a field whose column doesn't exist yet, so a script or a view that uses the field works the moment you save it.
  • A failed change fails at once, with the field named, while you are still looking at it, not later when somebody publishes a batch of twenty changes and one of them doesn't fit.
  • Promotion is where batching belongs. The moment you want several changes to arrive together is when they move to another environment, and that is exactly what a solution import does.

The cost is that a change you are unsure of is real in Development as soon as you save it. That is what Development is for.

If a save is refused

A save is never left half done. If a field's column can't be created, the field is taken out again, so a field you can see in the Fields list always has a column behind it. Whatever the message says, you can fix the problem and save again.

Next: the Organisation app.