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 ERD artifacts for TailorDB namespaces using Liam ERD. (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 namespacesNofalse-
--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)

tailordb migration

Manage TailorDB schema migrations.

Note: Migration scripts are automatically executed during tailor-sdk apply. 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 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 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 ERD artifacts for TailorDB namespaces using Liam ERD. (beta)

Usage

tailor-sdk tailordb erd [command]

Commands

CommandDescription
tailordb erd exportExport Liam ERD dist from applied TailorDB schema.
tailordb erd serveGenerate and serve ERD locally (liam build + serve dist). (beta)
tailordb erd deployDeploy ERD static website for TailorDB namespace(s).

See Global Options for options available to all commands.

tailordb erd export

Export Liam ERD dist from applied TailorDB schema.

Usage

tailor-sdk tailordb erd export [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 if only one namespace is defined in config)No--
--output <OUTPUT>-oOutput directory path for tbls-compatible ERD JSON (writes to <outputDir>/<namespace>/schema.json)No".tailor-sdk/erd"-

See Global Options for options available to all commands.

tailordb erd serve

Generate and serve ERD locally (liam build + serve dist). (beta)

Usage

tailor-sdk tailordb erd serve [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 (uses first namespace in config if not specified)No--

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.

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",
        },
      },
    });