AI Schema Generator for Onyx Cloud
The redesigned AI Schema Assistant transforms the way you design data models in the Onyx Cloud Admin Console. Describe the outcome you want, receive streaming recommendations, preview diffs, and apply production-ready changes—including attributes, indexes, resolvers, and triggers—in minutes.
Overview
The AI Schema Assistant pairs large-language-model intelligence with Onyx-specific validation. You can request net-new tables, modify existing entities, or refactor complex schemas without hand-editing JSON. The assistant streams a human-readable summary, generates table-by-table operations, and prepares diffs that you can safely review before publishing.
- Natural language prompts: Explain business rules or desired tables and let Onyx AI craft the structure.
- Instant previews: Summaries and diff views arrive in real time so you always understand the impact.
- Actionable operations: Apply changes with one click, or discard specific operations that you do not need.
Open the AI Schema Assistant
Launch the assistant directly inside the Schema Editor to keep your schema, AI guidance, and validation tools in one workspace.
Navigate to the Schema Editor
From the Onyx Cloud Admin dashboard, open your database and choose the Schema tab.
Select the AI Schema Generator tab
Inside the editor, switch to AI Schema Generator. The prompt panel, live status messaging, and diff controls are now anchored alongside your schema tree for quick iteration.
Review the latest context
The assistant automatically summarizes your active schema—including identifiers, resolvers, and triggers—so the AI understands existing constraints before generating updates.
Craft Prompts that Deliver
The prompt area accepts multi-line instructions. Press Enter to submit or Shift + Enter to add another line. Combine goals, constraints, and naming conventions to produce accurate results.
Prompt essentials
- Specify the table names and describe key attributes or relationships.
- Indicate whether you need new resolvers, indexes, or triggers.
- Call out identifier types, generators, or partitioning strategies.
- Ask the AI to modernize existing tables by referencing their current names.
Sample prompt
Create a "Campaign" table with a UUID identifier, partition by "status". Add attributes for name, objective, startDate, endDate, and budget (decimal). Add a resolver named "activeAds" that looks up related records in the Ads table. Update the existing "Lead" table to include campaignId and an index on email.
Interpret the Streaming Summary
As the AI processes your prompt, the status message beneath the textarea updates to Streaming response from Onyx AI…. Once complete, the assistant generates a rich HTML summary that highlights new tables, updated attributes, resolvers, indexes, and triggers.
- Color-coded badges call out additions, removals, and updates for each entity.
- Resolver lists display newly created resolver names so you can confirm coverage at a glance.
- Identifier callouts show generator choices, making it easy to verify key strategy decisions.
Review Diffs and Operations
Click Review latest diff to open the AI diff dialog. Each proposed operation—create, edit, or delete—is organized into tabs with Monaco-powered previews.
Navigate between operations
Tabs group changes by table name. A pulsing indicator shows operations that are still streaming data; solid indicators mark ready-to-apply updates.
Inspect JSON diffs
For edits, the split diff view compares your existing table with the AI suggestion. Creates render as formatted JSON you can copy for manual review.
Remove or retry
Not ready to apply a change? Click Remove on any tab to discard it from the batch, or close the dialog and submit an adjusted prompt.
Apply AI-Generated Schema Changes
When the operations look correct, finalize them right from the diff dialog.
Apply changes workflow
- Click Apply changes to merge the AI output into your working schema.
- Return to the form or JSON editor to make any final manual adjustments.
- Use Validate and Publish to deploy the schema to your database.
Safety controls
- Cancel streaming at any time if you need to stop the response.
- Revert closes the dialog without applying changes, keeping your current schema intact.
- Operations that fail validation are flagged with actionable error messages so you can adjust your prompt.
Automate Resolvers and Triggers with AI
Beyond table structures, the assistant can generate production-ready resolver and trigger definitions that follow the Onyx Database JavaScript SDK. Ask for computed relationships, cascade lookups, or event-driven automations in your prompt to get complete code snippets.
What the AI can deliver
- Resolver skeletons that call
db.from()with the correct filters and usethis.propertyto reference the current record. - Multi-step lookups expressed as sequential awaited queries—no manual wiring required.
- Trigger scripts that follow event naming conventions and return sanitized payloads.
After applying AI-generated operations, open the resolver or trigger sections in the Schema Form Editor to fine-tune names, add comments, or test in the Query Editor.
Best Practices for Prompting
- Iterate in batches: Break complex redesigns into focused prompts so each diff is easy to review.
- Reference existing tables: Mention table names exactly as they appear in your schema to avoid duplicates.
- Validate semantics: Even with AI assistance, ensure generated identifiers, resolvers, and triggers match your domain logic before publishing.
- Leverage summaries: Keep the summary card open while you compare diffs so you never miss a relationship change.
Troubleshooting
AI could not parse the table
If the diff dialog reports a parse error, the operation tab explains which property failed. Adjust your prompt to simplify the request or provide additional context, then regenerate.
No actionable changes detected
When the assistant cannot find differences, confirm that your prompt references real tables or includes the phrase “create a new table” to enforce a change.
Resolvers missing expected fields
Clarify resolver names and target attributes in your prompt. You can also remove the operation and craft a follow-up prompt that focuses solely on resolver generation.
Cancel and restart
Use the Cancel button while streaming to stop a response instantly. Your previous schema remains intact until you click Apply changes.
Next Steps
Need Help?
If you have any questions or need assistance:
- Email:support@onyx.dev
- Documentation: Visit ourHelp Centerfor tutorials and FAQs.