Skip to main content

Plan the table lifecycle

Design a table, create it in TaruviBase Console, check it before your application uses it, change it safely, and delete it when it's no longer needed.

Protect stored data

Schema changes and table deletion can permanently change or remove records. Export the table's data before either one.

Prerequisites​

  • A development app to try changes in first. Create one if needed.
  • An organization owner or admin account in TaruviBase Console, or another account allowed to manage the app's tables.

Procedure​

1. Design the table​

Give each application concept its own table, such as tasks, projects, or customers. Decide these before you store records:

  1. A stable lowercase snake_case name.
  2. The fields, their types, and which are required.
  3. Bounds, allowed values, and uniqueness rules.
  4. Foreign keys, and what happens to dependent records when a referenced record is deleted. Create referenced tables first.
  5. The filters and sorts that must stay fast as the table grows.

Use Fields and constraints for the field types and Plan indexes for indexing.

2. Create the table​

  1. In TaruviBase Console, open your app and select Datatables.
  2. Select Create New Table and enter the Table Name.
  3. Add each column with its Data Type, and check Required where needed. TaruviBase adds an id column (UUID, primary key) automatically.
  4. Select Create Table.

3. Check the table​

Open the table and select Definition. Check that it:

  • belongs to the right app;
  • has the name your application will use in requests;
  • has the fields, types, constraints, and foreign keys you designed.

Before your application uses the table, set up its access policy so each app role gets only the actions it needs, then test one allowed and one denied user for each action. See Test Database access policies.

4. Test the table with your application​

The Database guides use a tasks table with these fields:

FieldTypeRequiredNotes
idUUIDGeneratedPrimary key
titleTextYesTask title
doneBooleanYesCompletion state

In a development app:

  1. Create a record, then read it by ID and in a list.
  2. Send one record that breaks a constraint and confirm it's rejected.
  3. Page through more than one page of results with a stable sort.
  4. Clean up your test records with the record-deletion steps.

Continue with Work with records.

5. Change the table​

Schema changes can transform or remove stored data. Export the data first, try the change in a development app with representative records, then apply it to production. Follow Plan schema changes.

6. Delete a table​

Before you delete a table, stop the application code and jobs that use it, take out foreign keys in other tables that reference it, and export its data: open your app, select Datatables, open the table's menu, and select Export data.

Confirm deletion
  • Affected resource and cascade: The table and every record in it. Foreign keys from other tables can block deletion; the table's access policy is separate and should be removed afterwards.
  • Reversibility: Deleting a table is permanent and can't be undone.
  • Authorization: Requires an account allowed to manage the app's tables, such as an organization owner or admin.
  • Backup or export: Open the table's menu and select Export data first.
  • Confirmation: The Console asks you to type the table name before it enables Delete Table.
  • Success response and postcondition: The table disappears from Datatables, and requests to it return 404.
  • Recovery: Deleted tables can't be restored. Recreate the table and import the exported data.
  1. Delete the table: open the table's menu and select Delete table.
  2. Type the table name to confirm, then select Delete Table.

Verify​

After you create or change a table, compare Definition with your design, create and read a test record, and repeat your allowed and denied access checks. After you delete a table, confirm it no longer appears in Datatables and that no policy, job, or application code still uses it.

Next steps​