BYTE ON
Software Company
TKAMOL · Documentation
BYTE ONSOFTWARE COMPANY
TKAMOL · Legal Operations SaaS · Documentation
Part III · Technical Docs

Chapter 2 - Database Technical Reference

Engine and scope

ER Diagram and Key Groups

Detailed Table Group Table Names (authoritative list)

Core / framework

users, password_reset_tokens, sessions, cache, cache_locks, jobs, job_batches, failed_jobs, notifications (Laravel DB notifications).

Authorization

roles, permissions, model_has_permissions, model_has_roles, role_has_permissions (Spatie; custom models at app/Models/Role.php, app/Models/Permission.php).

Tenancy, users & workspace admins

workspaces, workspace_members, workspace_invitations, workspace_ai_agents, login_histories, audit_logs, performance_metrics, monthly_reports.

Projects / cases and work

projects, project_clients, project_members, project_milestones, project_notes, project_activities, project_attachments,

task_stages, tasks, task_comments, task_checklists, task_attachments, task_members, task_events, task_templates, task_template_langs, communications,

creator? users with created_by optional.

Timesheets

timesheets, timesheet_entries, timesheet_approvals.

Bugs

bug_statuses, bugs, bug_comments, bug_attachments.

Budgets

project_budgets, budget_categories, project_expenses, expense_approvals, expense_attachments, budget_revisions, budget_revision_approvals, expense_recurring, expense_workflows.

Invoicing & commerce

invoices, invoice_items, payments, currencies, payment_settings, coupons, plan_requests, plan_orders.

Referrals

referral_settings, referrals, payout_requests.

Plans

plans.

Email

email_accounts, email_messages, whatsapp_messages, webhooks.

Slack/Telegram/Zoom

slack_settings, telegram_settings, zoom_meetings, zoom_meeting_members.

Media & libraries

media, media_items.

Integrations AI

ai_batch_logs, ai_batch_log_entries, ai_chat_conversations, ai_chat_messages, ai_conversation_files, ai_knowledge_entries, ai_token_usage.

Communications, marketing

notification_templates, notification_template_langs, email_templates, email_template_langs, user_email_templates, newsletters, contacts, landing_page_settings, landing_page_custom_pages.

System/saas

settings.

Others

activities only referenced in seeders? categories, not referenced migrations (factories exist but no migration) remained after cleanup.

Model Relationships (intentional trace)

Models reference models as normal Eloquent relations listed in docs/models-columns.json (repo data file). Read app/Models/*.php for exact method names; keys from Populate model relationships:

Column details

Column definitions (key only; rely on migrations for full list). Invocation Schema::create() is accurate source. For contract updates, confirm every column via database/migrations or run SHOW COLUMNS (not possible in this audit no DB).

Useful columns that stand out:

users (key columns)

name, email (unique), password (nullable), lang, current_business, avatar, type (default 'company'), created_by, mode, is_enable_login, google2fa_secret, google2fa_enable, status, active_module, plan_id, plan_expire_date, requested_plan, plan_is_active, storage_limit, is_trial, trial_day, trial_expire_date, referral_code, used_referral_code, commission_amount, current_workspace_id, timer_* fields, profile fields (position, job_title, country, branch, phone, specialties, skills, gender, birthday, id_number, languages JSON, address, emergency_contact_*, employee_id, department, date_of_joining, contract_type, probation_end_date, hourly_rate, bank_name, bank_account_number, bank_routing_number, bank_iban, bank_swift), social block, created_at, updated_at.

Careful: all SaaS economics fields use nullable/default when not SaaS.

workspaces (key columns)

name, slug (unique), description, owner_id, settings (json), is_active, timesheet_enabled (bool), timesheet_approval_required (enum none/manager/admin), timesheet_auto_submit (bool), timesheet_reminder_days, default_work_start, default_work_end, budget_settings (json), is_suspended (bool).

projects (key columns)

workspace_id, title, description, status (planning,active,on_hold,completed,cancelled), priority (low,medium,high,urgent), start_date, deadline, estimated_hours, actual_hours, budget (decimal), progress, is_public, governance_settings (json), created_by, updated_by, deleted_at.

tasks (key columns)

project_id, task_stage_id, milestone_id, title, description, priority (low/medium/high/critical), start_date, due_date, status? (not listed in migration! Important: tasks has columns in migrations enumerated — no top-level status column itself except task_stage). completion etc., assigned_to, allow_multi_assign (bool), created_by, order, progress, created_at etc.

Note: allow_multi_assign 0/1; multi-assignees stored in task_members pivot.

invoices (key columns)

invoice_number (unique), project_id, workspace_id, client_id, created_by, title, invoice_date, due_date, subtotal, tax_rate, tax_amount, discount_amount, total_amount, paid_amount, status (draft/sent/viewed/paid/partial_paid/overdue/cancelled), sent_at, viewed_at, paid_at, payment_method, payment_reference, payment_token, payment_details (json), client_details (json), notes, terms, deleted_at.

payments (key columns)

created_by, invoice_id, workspace_id (nullable), payment_method, amount, payment_date, transaction_id, status, gateway_response (json), notes.

email_accounts (key columns)

user_id, workspace_id, host, port, encryption, username, password (text; encrypted in model) , is_active, filter_type (none/whitelist/blocklist), filter_list (json), sync_limit, sync_unseen, automation_settings (json), use_idle (named last in later migrations).

email_messages (key columns)

account_id, message_id (unique), uid, from_email, from_name, to_email, subject, body_html, body_text, date, reply_to, received_path, is_read, project_id, task_id, bug_id, is_automated, ai_decision (json), reassignment_count.

tasks event types

task_id, event_type (assigned/submitted/returned/approved), triggered_by (email/manager/system), execution_minutes, return_count, return_reason, performance_status (on_time/delayed/critical).

Seeders Summary

Migration conventions & history tracking

Migration highlights (selected)

Key integrity notes (identified)

  1. No explicit global tenant scope; relies on queries.
  2. WorkspaceObserver runs in every workspace creation (automation guard).
  3. UserObserver decides default plan under SaaS.
  4. TaskObserver injects TaskEvent each transition, including name substring-based logic.
  5. Keys: each users.email unique; workspaces.slug unique.
  6. Certain foreign keys (email_messages -> tasks/projects/bugs) use nullable with set null to retain data.
  7. Expense (budget) parent relationship manually established via project_id columns instead of dedicated FKs; quality risk under data integrity (coders).
  8. Unique (workspace_id, user_id) on workspace_members.
  9. Some pivots (project_clients, task_members, workspace_members) include primary keys and timestamps.

Data retention deletion and GDPR-style

← Technology, Architecture, Setup and Maintenance API and Routes Reference →