Rezin Core Rezin Core Docs Sign in

Database

Tables and the table editor

The Data → Tables makes and changes tables, columns, links between tables and indexes without SQL, and lets you look at and edit rows.

Every change runs as the project's own confined database role, so it reaches this project's section of the database and nothing else.

A new table

Choose New table, give it a name and its columns. Names are lowercase letters, digits and underscores, starting with a letter or underscore, up to 63 characters.

A table made here has row-level security on from the first moment and no rule. The application is given no rows from it until you write a policy on the Security → Access rules page. The table list and the table's own page say so until then. See Row-level security and policies.

Column types

In the editorIn the database
Texttext
Whole numberinteger
Whole number (large)bigint
Exact decimalnumeric
Decimal (approximate)double precision
True or falseboolean
IDuuid
Date and timetimestamptz
Datedate
Time of daytime
JSONjsonb
Bytesbytea
List of texttext[]

Any other Postgres type can be used by creating the table in SQL.

Defaults

A column can have a ready-made default, a fixed value, or an expression.

Ready-made defaultWhat it writes
Random IDgen_random_uuid()
Nownow()
Todaycurrent_date
True, Falsetrue, false
Current organizationcore.app_org(): the organization the request acts for
Current personcore.app_user(): the signed-in user, or null
Empty object'{}'::jsonb
Empty list'{}'::text[]

"Current organization" on an organization_id column and "Current person" on an owner column are the two that make policies simple.

  • A primary key. Realtime and webhooks need one, and so does editing a row.
  • organization_id (ID, default Current organization) on any table whose rows belong to a tenant. The API fills it in on new rows, and realtime needs it to deliver deletes.

Changing a table

Open a table and choose Structure:

  • Columns: add, rename, change or remove a column; make it required or optional; set or clear its default.
  • Links to other tables: a column that must match a row of another table (a foreign key), with what happens when that row is deleted: refuse, delete this row too, or clear the value.
  • Indexes: an index makes looking rows up by those columns fast. A unique one also refuses two rows with the same values.
  • Realtime: switch row-change messages on or off for this table. See Realtime.
  • Rename and Delete table. Deleting removes the table and every row in it and cannot be undone from the console.

A table that your own migrations made is changed in your migrations, not in the editor: the editor shows it but will not alter its structure.

Rows

The table's own page shows its rows, and you can add, change and delete them. This runs as the project's own role, so it shows every row regardless of policies. It is for the project's members, not a picture of what the application gets.

Who can do this

Owners and developers of the workspace. Read-only members can look and cannot change anything. Every structure change and row edit is on the project's audit record.

This page as Markdown · llms.txt · Rezin Core is in development and available by invitation.