1. Home
  2. 4: Data Tables

Overview of Primary and Secondary MySQL Tables in Rayven.io

Rayven.io, MySQL tables play a critical role in managing structured data across solutions. These tables can be categorized into primary and secondary tables depending on their intended purpose and integration level within workflows and interfaces.

In Rayven.io, structured data is managed using MySQL tables. These tables are split into two types:

  • Primary Tables: Store the core records for your solution (e.g., customers, projects, transactions).

  • Secondary Tables: Extend or enrich primary data with logs, lookups, or related events.

This structure supports clean, relational data models that power workflows, interfaces, AI agents, and reports.


Use Cases (Non-IoT)

  • Create a Customers table to track client details and account status.

  • Store support tickets or billing history in a secondary table linked to each customer.

  • Maintain product and service catalogs in primary tables.

  • Use secondary tables to track employee time logs or service interactions.

  • Enable internal dashboards for HR, finance, or customer success using structured data from these tables.


How It Works

Primary Tables

Definition:
Core tables that store your most important business records.

Common Use Cases:

  • Customers: Contact info, status, industry

  • Projects: Name, owner, stage, deadline

  • Orders: Order date, value, customer ID

  • Employees: Role, department, hire date

Integration:

  • Workflows can update primary tables based on business logic (e.g., auto-assign account managers).

  • Interfaces can create, edit, or display records from primary tables in dashboards and forms.

  • AI agents can reference primary tables for summarizing, predicting, or validating data.


Secondary Tables

Definition:
Supplemental tables used for reference data, logs, or one-to-many relationships with primary records.

Common Use Cases:

  • SupportTickets: Issue logs linked to Customer_ID

  • InvoiceHistory: Past billing records linked to Order_ID

  • TimeLogs: Employee hours linked to Employee_ID

  • Departments: Reference data for Employees

  • SubscriptionChanges: Version history of product plans

Integration:

  • Used in dropdowns, filters, and field lookups.

  • Dynamically updated by workflows (e.g., log every project status change).

  • Frequently read-only in dashboards but may allow new entries (e.g., log a new support call).


Comparison Table

Feature Primary Table Secondary Table
Purpose Core business entities Enrichment, logs, lookup data
Editable? Yes (UI and workflow) Yes (but often read-heavy)
Examples Customers, Orders, Projects SupportTickets, InvoiceHistory
Workflow Usage Source + destination Lookup or relational input
Interface Usage Forms, grids, reports Dropdowns, filters, linked logs
 

Step-by-Step Instructions

Step 1: Create a Table

  1. Go to Tables.

  2. Click Add New under Primary or Secondary.

  3. Name the table, define fields, and set types (e.g., string, date, number).

  4. Save your configuration.

đź’ˇ Tip: Always add a unique field like Customer_ID or Order_ID to a primary table.

Step 2: View a Table

  • Use the View button to inspect records and schema details.

Step 3: Edit a Table

  • Click Edit to update columns, data types, or rows.

  • You can import bulk records via CSV or JSON.


Best Practices

  • Use snake_case or CamelCase naming (e.g., orderStatus, project_logs).

  • Keep primary tables minimal—store only essential data there.

  • Use secondary tables for activity logs, versioning, or one-to-many relationships.

  • Avoid circular dependencies.

  • Regularly archive inactive records to optimize performance.


Example Table Design

Table Name Type Description
Customers Primary Core CRM record for each client
Projects Primary All ongoing or historical projects
SupportTickets Secondary Issues logged per customer
ProjectUpdates Secondary Status change history for projects
Departments Secondary Static reference table for HR
 

Troubleshooting

  • Can’t link tables? → Ensure foreign key (e.g., Customer_ID) exists in both.

  • Changes not saving? → Check for blank required fields or type mismatches.

  • Table not showing? → Refresh the interface or confirm your permissions.


Q&A

Q: What’s the difference between a primary and a secondary table?

A: A primary table stores the core data for your solution (e.g., customers, orders, projects), while a secondary table supports it with reference data, logs, or one-to-many relationships (e.g., support tickets, invoice history).


Q: Can I edit both types of tables through the UI or workflows?

A: Yes. Both primary and secondary tables can be edited via the UI and workflows, but secondary tables are typically more read-heavy and used for logging or reference purposes.


Q: When should I use a secondary table instead of adding more columns to a primary table?

A: Use a secondary table when you need to store multiple records that relate to one entry in a primary table. For example, a customer can have many support tickets—those should go in a secondary SupportTickets table.


Q: Can I link multiple secondary tables to the same primary table?

A: Absolutely. This is a common pattern. For example, a Customers table might link to SupportTickets, Invoices, and ActivityLogs, each as separate secondary tables.


Q: How do I reference a primary record in a secondary table?

A: Include a field in the secondary table (e.g., Customer_ID) that stores the unique ID from the primary table. This enables you to link and filter data relationally.


Q: Can I use tables in dashboards and reports?

A: Yes. Primary tables are often used in grids and reports, while secondary tables support filters, dropdowns, and drill-down views (e.g., showing ticket history when viewing a customer).


Q: What if my table isn’t showing in the interface?

A: Check that you have permission to view it, the table is published or shared correctly, and the interface is bound to it. Refresh the dashboard if needed.