Studio
Tables
Create, rename, and delete tables, and manage their columns and foreign keys in Fakebase Studio.
Open Tables in the sidebar to see every table in the database. Use Search tables to find one, and the schema filter to switch between schemas. Select a table to open it.
Each table has three tabs: Data for its rows (see Data), Columns, and RLS.
Create a table
- Choose New table, or press ⌘N.
- Enter a Name and an optional Description.
- Add columns. For each one, set the name, type, and default value, and whether it's the primary key. Under Extra options you can make it nullable, unique, an identity column, or an array.
- Optionally add foreign keys with Add foreign key relation.
- Save. Studio creates the table in the schema shown at the top of the form.
Rename or delete a table
Open the table's menu (⋮) in the list, or right-click it:
- Change table name renames the table. Its rows, indexes, and constraints stay.
- Delete table removes the table and all its data.
The _fakebase_migrations table holds your migration history, so it can't be renamed or deleted.
Columns
Open a table and choose the Columns tab.
- Add a column: choose Add column, set its name, type, default value, and constraints, then save.
- Edit a column: open the column's menu and choose Edit column. You can change its name, type, default value, and constraints.
- Remove a column: open the column's menu and choose Remove column. Studio tells you when a column can't be removed, for example the last column of a table, or one that another table's foreign key points to.
Foreign keys
Add a foreign key while you create a table, or later from the column it belongs to:
- Open the Columns tab and edit the column.
- Choose Add foreign key.
- Pick the schema, table, and column it references.
- Choose what happens when the referenced row is updated or removed.
- Save.
To remove a foreign key, edit the column and remove it from Foreign Keys. To see how all your tables connect, open Schema.
Row-level security
The RLS tab shows whether row-level security is on for the table, and each policy with its command and its USING and WITH CHECK expressions. Select a policy to copy its details.
This tab is read-only. To change policies, write the SQL in a migration.