[data-reveal]{opacity:1!important;transform:none!important}
Extending
Database

Extending

How your tables show up in the console, the Table watch automation trigger, and how roles and links reach the module's pages.

The module has no interface of its own to implement: it reads what the rest of the project already declares. This page explains what it picks up and how other modules use it.

Supported extension boundary

Use registered database schemas, the Table watch trigger, configuration and deep links documented here. The runtime's root barrel also re-exports its page and route classes; those exports exist, but they do not define a separate extension SDK or a supported subclassing contract. Do not register those controllers again or depend on their implementation methods. Declare your own pages through @antelopejs/interface-dms and tables through the database interfaces instead.

Your tables appear on their own

Every schema registered through @antelopejs/interface-database-decorators appears in the console, with its tables, columns, indexes and relations. There is nothing to add for the console:

import { BasicDataModel, Field, Index, RegisterSchema, RegisterTable, Table } from "@antelopejs/interface-database-decorators";

@RegisterTable("posts", "blog")
export class Post extends Table {
  @Field("string") declare _id: string;
  @Index() @Field("string") declare title: string;
  @Field("string") declare author: string;
}

export class PostModel extends BasicDataModel(Post, "posts") {}

export async function start(): Promise<void> {
  await RegisterSchema("blog");
}

Keep the table in src/db/posts.table.ts, import it from your module entry, and merge RegisterSchema("blog") into that entry's start() hook. @Field declares each column's storage type; @Index alone does not declare a field. Each instance of the schema (the default one, one per tenant, one per region) is listed in the instance pickers. Columns marked hashed, localized or encrypted carry a modifier badge.

Give a schema a readable badge with schemaLabels rather than renaming it: schema IDs are part of the stored data.

Table watch automation trigger

When @antelopejs/dms-automation is loaded, the module registers the Table watch trigger (database.table-watch). It fires a procedure on each insert, update or delete in a table, from the database change feed. Without the automation module, the registration is a silent no-op.

ConfigTypeRequiredDescription
schemastringyesRegistered schema ID, such as shop.
tablestringyesTable name inside the schema.
eventTypes("insert" | "update" | "delete")[]noChange types to fire on. Omit it for all three.

Each event passes this output to the procedure:

FieldTypeDescription
type"insert" | "update" | "delete"The change.
oldobject | nullThe row before the change: null on insert, possibly only the primary key when the store keeps no pre-image.
newobject | nullThe row after the change: null on delete.
schema, tablestringWhere the change happened.
atstring (date-time)When the module received it.
The trigger needs a database with a change feed. MongoDB only offers one on a replica set: on a standalone server, activation fails with "$changeStream is only supported on replica sets". The trigger runs on one node of a cluster only, and reconnects once after a feed error.

Roles and components

Each block of the module's pages carries .meta({ name, icon, description }), so the DMS role editor lists them and lets you hide one per role: the connection card, the schema cards, the largest tables, the recent queries, the table list, the inspector, the diagram, the data browser and the query console. The pages themselves stay reserved to the platform owner.

The pages read their selection from the URL, so any page, notification or row action can deep-link into the console:

LinkOpens
/modules/database/schemas?record=<schema>::<table>The table inspector
/modules/database/diagram?schema=<schema>&table=<table>The diagram, focused on a table
/modules/database/data?schema=<schema>&table=<table>The table in the data browser
/modules/database/query?schema=<schema>&table=<table>The query console on that table

Add instance=<name> for a non-default instance, or instance=all for every instance.

Frontend components

The module ships a Vue 3 frontend module registered under the DmsDatabase component prefix (DmsDatabaseDataBrowser, DmsDatabaseQueryConsole, DmsDatabaseSchemaDiagram, DmsDatabaseTableInspector, DmsDatabaseConnectionStatus). They are built for the module's own pages and backed by owner-only routes under /api/database: they are not a public API for other modules.