beehive_accounts
CREATE TABLE beehive_accounts (
id BIGSERIAL PRIMARY KEY,
organization_id BIGINT NOT NULL UNIQUE REFERENCES organizations(id),
-- Status
status VARCHAR(50) DEFAULT 'active',
-- 'active', 'completed', 'expired'
-- Setup progress (8 steps)
setup_progress JSONB DEFAULT '{
"step1_plan": false,
"step2_usertype": false,
"step3_team": false,
"step4_beezora": false,
"step5_channels": false,
"step6_ai_config": false,
"step7_webchat": false,
"step8_automations": false
}',
-- Readiness score (0-100)
readiness_score INT DEFAULT 0,
-- Dates
created_at TIMESTAMP DEFAULT NOW(),
expires_at TIMESTAMP, -- 29 days from creation
went_live_at TIMESTAMP,
INDEX idx_beehive_accounts_org (organization_id),
INDEX idx_beehive_accounts_status (status)
);
beehive_data_sync
CREATE TABLE beehive_data_sync (
id BIGSERIAL PRIMARY KEY,
beehive_account_id BIGINT NOT NULL REFERENCES beehive_accounts(id),
-- Sync status
sync_status VARCHAR(50) DEFAULT 'pending',
-- 'pending', 'in_progress', 'completed', 'failed'
-- Data counts
contacts_synced INT DEFAULT 0,
automations_synced INT DEFAULT 0,
templates_synced INT DEFAULT 0,
settings_synced BOOLEAN DEFAULT FALSE,
-- Error tracking
errors JSONB DEFAULT '[]',
started_at TIMESTAMP,
completed_at TIMESTAMP,
INDEX idx_beehive_sync_account (beehive_account_id)
);