SQL
CREATE TABLE confirmed_orders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
chatbot_id INTEGER NOT NULL,
conversation_id INTEGER NOT NULL,
user_id TEXT NOT NULL,
customer_name TEXT NOT NULL,
customer_phone TEXT NOT NULL,
customer_email TEXT,
customer_address TEXT,
order_items TEXT NOT NULL,
total_cost REAL NOT NULL,
currency TEXT DEFAULT 'EUR',
status TEXT DEFAULT 'pending',
created_at TEXT NOT NULL,
updated_at TEXT,
FOREIGN KEY (chatbot_id) REFERENCES chatbots(id) ON DELETE CASCADE,
FOREIGN KEY (conversation_id) REFERENCES conversations(id) ON DELETE CASCADE
)
Columns
| Column | Data type | Allow null | Primary key | Actions |
|---|---|---|---|---|
id |
INTEGER |
✓ | ✓ | Rename | Drop |
chatbot_id |
INTEGER |
Rename | Drop | ||
conversation_id |
INTEGER |
Rename | Drop | ||
user_id |
TEXT |
Rename | Drop | ||
customer_name |
TEXT |
Rename | Drop | ||
customer_phone |
TEXT |
Rename | Drop | ||
customer_email |
TEXT |
✓ | Rename | Drop | |
customer_address |
TEXT |
✓ | Rename | Drop | |
order_items |
TEXT |
Rename | Drop | ||
total_cost |
REAL |
Rename | Drop | ||
currency |
TEXT |
✓ | Rename | Drop | |
status |
TEXT |
✓ | Rename | Drop | |
created_at |
TEXT |
Rename | Drop | ||
updated_at |
TEXT |
✓ | Rename | Drop |
Foreign Keys
| Column | Destination |
|---|---|
conversation_id |
conversations.id |
chatbot_id |
chatbots.id |
Indexes
| Name | Columns | Unique | SQL | Drop? |
|---|---|---|---|---|
| idx_confirmed_orders_chatbot_id |
chatbot_id
|
SQL | Drop | |
| idx_confirmed_orders_created_at |
created_at
|
SQL | Drop | |
| idx_confirmed_orders_status |
status
|
SQL | Drop |