Tables & Fields
Create tables, add fields, and manage your database schema in Spala.
Tables & Fields
Tables hold your data. Each table has fields (columns) that define what data it stores.
Create a table
Open the Database section
Click Database in the left sidebar.
Add a new table
Click Add Table and enter a name. Use lowercase with underscores for multi-word names (e.g., order_items).
Add fields
Every table starts with an auto-generated id column. Click Add Field to add more.
Save
Click Save to create the table in your database.
Field types
| Type | Stores | Example values | |-----------|--------------------------------|-----------------------------------| | Text | Strings | "Jane", "[email protected]" | | Number | Integers or decimals | 42, 19.99 | | Boolean | True or false | true, false | | Date | Dates and timestamps | 2025-01-15, now() | | JSON | Arbitrary structured data | {"color": "blue"} | | Enum | One of a predefined set | 'pending', 'active' |
Field options
| Option | What it does | |-----------|--------------------------------------------------------------| | Required | The field must have a value (cannot be empty) | | Unique | No two rows can have the same value | | Default | A value used when none is provided (e.g., 0, 'pending', now()) |
Pro tip
Enable Timestamps on a table to auto-add created_at and updated_at fields. They update automatically.
Edit and delete
- Rename a field — Click the field name in the schema editor and type a new one. - Change a type — Select a different type from the dropdown. Be careful with existing data. - Delete a field — Click the delete icon next to the field. - Delete a table — Use the context menu on the table name. Spala warns when other resources depend on that table.
View and edit data
Click a table, then switch to the Data tab to browse rows, search records, page through larger tables, add test data, edit values inline, or delete rows. This is handy for development, QA, and debugging.
Use the table tabs for the full table workflow:
- Data - Browse, search, edit, import, export, generate, and delete records. - Schema - Add fields, change types, review constraints, and update table structure. - Triggers - Create logic that runs when records are inserted, updated, or deleted.
Common table patterns
Users table:
| Field | Type | Options | |--------------|---------|--------------------| | email | Text | Required, Unique | | password_digest| Text | Required | | role | Enum | Default: 'user' |
Products table:
| Field | Type | Options | |------------|---------|-------------------| | name | Text | Required | | price | Number | Required | | in_stock | Boolean | Default: true | | category_id| Number | Foreign key |
Import and generate data
- CSV import — Upload a CSV file to bulk-import records into any table. Spala maps columns automatically. - CSV export — Download all records from a table as a CSV file. - Generate test data — Click Generate Data to create realistic test records for multiple tables at once.
Relationships /database/relationships Connect tables with foreign keys Functions /flows Query your tables in functions Database Triggers /triggers/database-triggers Run logic when records change