Skip to content

TailorDB Commands

Commands for managing TailorDB tables, data, and schema migrations.

tailordb

Manage TailorDB tables and data.

Usage

tailor-sdk tailordb [command]

Commands

CommandDescription
tailordb truncateTruncate (delete all records from) TailorDB tables.
tailordb migrationManage TailorDB schema migrations.
tailordb erdGenerate TailorDB ERD viewer artifacts from local TailorDB schema. (beta)

See Global Options for options available to all commands.

tailordb truncate

Truncate (delete all records from) TailorDB tables.

Usage

tailor-sdk tailordb truncate [options] [types]

Arguments

ArgumentDescriptionRequired
typesType names to truncateNo

Options

OptionAliasDescriptionRequiredDefaultEnv
--workspace-id <WORKSPACE_ID>-wWorkspace IDNo-TAILOR_PLATFORM_WORKSPACE_ID
--profile <PROFILE>-pWorkspace profileNo-TAILOR_PLATFORM_PROFILE
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--yes-ySkip confirmation promptsNofalse-
--all-aTruncate all tables in all owned namespaces (excludes external namespaces)Nofalse-
--namespace <NAMESPACE>-nTruncate all tables in specified namespaceNo--

See Global Options for options available to all commands.

Usage Examples:

bash
# Truncate all tables in all namespaces (requires confirmation)
tailor-sdk tailordb truncate --all

# Truncate all tables in all namespaces (skip confirmation)
tailor-sdk tailordb truncate --all --yes

# Truncate all tables in a specific namespace
tailor-sdk tailordb truncate --namespace myNamespace

# Truncate specific types (namespace is auto-detected)
tailor-sdk tailordb truncate User Post Comment

# Truncate specific types with confirmation skipped
tailor-sdk tailordb truncate User Post --yes

Notes:

  • You must specify exactly one of: --all, --namespace, or type names
  • When truncating specific types, the namespace is automatically detected from your config
  • Confirmation prompts vary based on the operation:
    • --all: requires typing truncate all
    • --namespace: requires typing truncate <namespace-name>
    • Specific types: requires typing yes
  • Use --yes flag to skip confirmation prompts (useful for scripts and CI/CD)
  • Namespaces declared with { external: true } are skipped by --all and rejected with a dedicated error when targeted by --namespace. Run truncate from the app that owns the namespace.

tailordb migration

Manage TailorDB schema migrations.

Note: Migration scripts are automatically executed during tailor-sdk deploy. See Automatic Migration Execution for details.

Usage

tailor-sdk tailordb migration [command]

Commands

CommandDescription
tailordb migration generateGenerate migration files by detecting schema differences between current local types and the previous migration snapshot.
tailordb migration scriptAdd a migration script (migrate.ts) template to an existing migration directory.
tailordb migration setSet migration checkpoint to a specific number.
tailordb migration statusShow the current migration status for TailorDB namespaces, including applied and pending migrations.

See Global Options for options available to all commands.

tailordb migration generate

Generate migration files by detecting schema differences between current local types and the previous migration snapshot.

Usage

tailor-sdk tailordb migration generate [options]

Options

OptionAliasDescriptionRequiredDefaultEnv
--yes-ySkip confirmation promptsNofalse-
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--name <NAME>-nOptional description for the migrationNo--
--init-Delete existing migrations and start freshNofalse-

See Global Options for options available to all commands.

tailordb migration script

Add a migration script (migrate.ts) template to an existing migration directory.

Usage

tailor-sdk tailordb migration script [options] <number>

Arguments

ArgumentDescriptionRequired
numberMigration number to add a script to (e.g., 0001 or 1)Yes

Options

OptionAliasDescriptionRequiredDefaultEnv
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--namespace <NAMESPACE>-nTarget TailorDB namespace (required if multiple namespaces exist)No--

See Global Options for options available to all commands.

tailordb migration set

Set migration checkpoint to a specific number.

Usage

tailor-sdk tailordb migration set [options] <number>

Arguments

ArgumentDescriptionRequired
numberMigration number to set (e.g., 0001 or 1)Yes

Options

OptionAliasDescriptionRequiredDefaultEnv
--workspace-id <WORKSPACE_ID>-wWorkspace IDNo-TAILOR_PLATFORM_WORKSPACE_ID
--profile <PROFILE>-pWorkspace profileNo-TAILOR_PLATFORM_PROFILE
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--yes-ySkip confirmation promptsNofalse-
--namespace <NAMESPACE>-nTarget TailorDB namespace (required if multiple namespaces exist)No--

See Global Options for options available to all commands.

tailordb migration status

Show the current migration status for TailorDB namespaces, including applied and pending migrations.

Usage

tailor-sdk tailordb migration status [options]

Options

OptionAliasDescriptionRequiredDefaultEnv
--workspace-id <WORKSPACE_ID>-wWorkspace IDNo-TAILOR_PLATFORM_WORKSPACE_ID
--profile <PROFILE>-pWorkspace profileNo-TAILOR_PLATFORM_PROFILE
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--namespace <NAMESPACE>-nTarget TailorDB namespace (shows all namespaces if not specified)No--

See Global Options for options available to all commands.

See also: For migration concepts, configuration, workflow, and troubleshooting, see the TailorDB Migrations guide.

tailordb erd

Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta)

Usage

tailor-sdk tailordb erd [command]

Commands

CommandDescription
tailordb erd exportExport TailorDB ERD static viewer from local TailorDB schema.
tailordb erd serveGenerate and serve TailorDB ERD locally with watch reload. (beta)
tailordb erd deployDeploy ERD static website for TailorDB namespace(s).

See Global Options for options available to all commands.

tailordb erd export

Export TailorDB ERD static viewer from local TailorDB schema.

Usage

tailor-sdk tailordb erd export [options]

Options

OptionAliasDescriptionRequiredDefaultEnv
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--namespace <NAMESPACE>-nTailorDB namespace name (optional if only one namespace is defined in config)No--
--output <OUTPUT>-oOutput directory path for TailorDB ERD viewer files (writes to <outputDir>/<namespace>/dist)No".tailor-sdk/erd"-

See Global Options for options available to all commands.

tailordb erd serve

Generate and serve TailorDB ERD locally with watch reload. (beta)

Usage

tailor-sdk tailordb erd serve [options]

Options

OptionAliasDescriptionRequiredDefaultEnv
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--namespace <NAMESPACE>-nTailorDB namespace name (uses first namespace in config if not specified)No--
--port <PORT>-Local server port (0 selects a free port)No0-
--open-Open the ERD viewer in the default browserNofalse-

See Global Options for options available to all commands.

tailordb erd deploy

Deploy ERD static website for TailorDB namespace(s).

Usage

tailor-sdk tailordb erd deploy [options]

Options

OptionAliasDescriptionRequiredDefaultEnv
--workspace-id <WORKSPACE_ID>-wWorkspace IDNo-TAILOR_PLATFORM_WORKSPACE_ID
--profile <PROFILE>-pWorkspace profileNo-TAILOR_PLATFORM_PROFILE
--config <CONFIG>-cPath to SDK config fileNo"tailor.config.ts"TAILOR_PLATFORM_SDK_CONFIG_PATH
--namespace <NAMESPACE>-nTailorDB namespace name (optional - deploys all namespaces with erdSite if omitted)No--

See Global Options for options available to all commands.

Notes:

  • ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
  • tailordb erd export writes a self-contained index.html viewer to <output>/<namespace>/dist.
  • tailordb erd serve watches the config file and TailorDB type files, then reloads the browser viewer when the rebuilt index.html reports a new embedded schema revision.
  • tailordb erd deploy still requires erdSite in tailor.config.ts because it uploads the generated viewer to a configured Static Website.

Usage Examples:

bash
# Deploy ERD for all namespaces with erdSite configured
tailor-sdk tailordb erd deploy

# Deploy ERD for a specific namespace
tailor-sdk tailordb erd deploy --namespace myNamespace

# Deploy ERD with JSON output
tailor-sdk tailordb erd deploy --json

Notes:

  • This command is a beta feature and may introduce breaking changes in future releases
  • Requires erdSite to be configured in tailor.config.ts for each namespace you want to deploy
  • Example config:
    typescript
    export default defineConfig({
      db: {
        myNamespace: {
          // ... table definitions
          erdSite: "my-erd-site-name",
        },
      },
    });