Agendamentos
0 rows where conversation_id = 1 sorted by scheduled_at descending
This data as json
0 records
CREATE TABLE appointment (
appointment_id INTEGER PRIMARY KEY AUTOINCREMENT,
seller_id INTEGER NOT NULL REFERENCES seller(seller_id) ON DELETE CASCADE,
customer_id INTEGER NOT NULL REFERENCES customer(customer_id),
conversation_id INTEGER REFERENCES conversation(conversation_id),
service_id INTEGER REFERENCES service(service_id),
title TEXT NOT NULL DEFAULT '',
scheduled_at TEXT NOT NULL, -- ISO8601: "2026-06-18T14:00:00-03:00"
duration_minutes INTEGER NOT NULL DEFAULT 60 CHECK (duration_minutes > 0),
status TEXT NOT NULL DEFAULT 'pending',
notes TEXT NOT NULL DEFAULT '',
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
CHECK (status IN ('pending', 'confirmed', 'cancelled', 'completed', 'no_show'))
);
CREATE INDEX idx_appointment_seller ON appointment(seller_id, scheduled_at);
CREATE INDEX idx_appointment_customer ON appointment(customer_id);
CREATE INDEX idx_appointment_status ON appointment(seller_id, status);