- Add autotask-architecture.svg showing intent classification flow - Convert all designer-panel format to wa-chat (WhatsApp style) - Remove emojis and icons per PROMPT.md standards - Convert ASCII diagrams to tables - Delete CODER-PROMPT.md and implementation.md - Rename chapter from 21 to 17 - Add 6 SVG diagrams for chapter 17 - Fix book.toml: devchat-panel.css to designer-panel.css - Update SUMMARY.md with correct paths
3.8 KiB
Data Model
Tables store your application data. When you describe what you need, the system creates table definitions automatically in tables.bas.
What Is a Table?
A table organizes related data into rows and columns, similar to a spreadsheet.
| id | name | phone | |
|---|---|---|---|
| 1 | John Smith | 555-1234 | john@email.com |
| 2 | Maria Garcia | 555-5678 | maria@email.com |
Creating Tables
Describe what data you need to store.
I need a customers table with name, phone, and email
customers table created with fields:
name (STRING)
phone (STRING)
email (STRING)
Adding Fields
Add new fields to existing tables through conversation.
Add address to customers
Address field added to customers table.
Field Types
| Type | Use For | Example |
|---|---|---|
STRING |
Short text | Names, phones |
TEXT |
Long text | Notes, descriptions |
INTEGER |
Whole numbers | Age, quantity |
DECIMAL |
Numbers with decimals | Price, weight |
BOOLEAN |
Yes/No values | Active, completed |
DATE |
Dates only | Birth date |
DATETIME |
Date and time | Appointment time |
Searching Data
Use natural language to find records.
Find customers named Smith
Found 2 customers:
John Smith - 555-1234
Jane Smith - 555-9876
Linking Tables
Create relationships between tables.
Create orders table linked to customers
orders table created with:
customer_id (links to customers)
date (DATETIME)
total (DECIMAL)
status (STRING)
Shared Data
All applications within a bot share the same tables. Change data in one app, and it updates everywhere.
| Concept | Description |
|---|---|
| One bot = one database | All apps share tables |
| Schema in tables.bas | Single source of truth |
| Auto-sync | Changes deploy automatically |
TABLE Keyword
Tables are defined in .gbdialog/tables.bas using the TABLE keyword:
| Syntax | Description |
|---|---|
TABLE name |
Start table definition |
field AS TYPE |
Define a field |
END TABLE |
End table definition |
FIND Keyword
Query data using the FIND keyword:
| Syntax | Description |
|---|---|
FIND * IN table |
Get all records |
FIND * IN table WHERE condition |
Filter records |
FIND field1, field2 IN table |
Select specific fields |
Next Steps
- Designer Guide — Modify tables through conversation
- Examples — Real-world data models