Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
feat(objectql): auto-sync registered object schemas to database on startup#942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1164,6 +1164,24 @@ export class ObjectQL implements IDataEngine { | ||||||||||||||||
| return this.drivers.get(name); | ||||||||||||||||
| } | ||||||||||||||||
| /** | ||||||||||||||||
| * Get the driver responsible for the given object. | ||||||||||||||||
| * | ||||||||||||||||
| * Resolves datasource binding from the object's schema definition, | ||||||||||||||||
| * falling back to the default driver. This is a public version of | ||||||||||||||||
| * the internal getDriver() used by CRUD operations. | ||||||||||||||||
| * | ||||||||||||||||
| * @param objectName - FQN or short name of the registered object. | ||||||||||||||||
| * @returns The resolved DriverInterface, or undefined if no driver is available. | ||||||||||||||||
| */ | ||||||||||||||||
| getDriverForObject(objectName: string): DriverInterface | undefined { | ||||||||||||||||
| try { | ||||||||||||||||
| return this.getDriver(objectName); | ||||||||||||||||
| } catch { | ||||||||||||||||
CopilotAI | ||||||||||||||||
| }catch{ | |
| }catch(error){ | |
| this.logger?.warn?.( | |
| `[ObjectQL] getDriverForObject: failed to resolve driver for object '${objectName}': ${ | |
| errorinstanceofError ? error.message : String(error) | |
| }`, | |
| ); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -119,6 +119,11 @@ export class ObjectQLPlugin implements Plugin { | ||||||
| // Initialize drivers (calls driver.connect() which sets up persistence) | ||||||
| await this.ql?.init(); | ||||||
| // Sync all registered object schemas to database | ||||||
| // This ensures tables/collections are created or updated for every | ||||||
| // object registered by plugins (e.g., sys_user from plugin-auth). | ||||||
CopilotAI | ||||||
| // object registered by plugins (e.g., sys_user from plugin-auth). | |
| // object registered by plugins (e.g., sys__user from plugin-auth). |
CopilotAIMar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a schema sync fails, the warn log only captures e.message (or String(e)), which drops stack traces for Error instances and makes diagnosis harder. Consider including stack (when available) in the metadata or logging the full error details in a structured way.
CopilotAIMar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syncRegisteredSchemas() only emits the final "Schema sync complete" info log when synced > 0 || skipped > 0. If all objects have a driver+syncSchema but every call throws, this produces no summary log even though work was attempted. Consider tracking a failed counter and always logging a summary (or at least logging when failed > 0) so operators can tell startup schema sync ran but encountered errors.
Uh oh!
There was an error while loading. Please reload this page.
CopilotAIMar 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog entry references
sys_user, but system plugin objects in thesysnamespace are registered assys__user(FQN with double underscore). Updating the example name here would better match what users will actually see in logs/DB identifiers.