snapshot
Reference
Snaplet CLI

CLI Commands

You can use the Command-Line Interface (CLI) provided by npx @snaplet/snapshot to manage your data from a terminal window.

config

The npx @snaplet/snapshot config command is used to manage configuration.

Usage

>_ terminal

npx @snaplet/snapshot config [action]

generate

The npx @snaplet/snapshot config generate command is used to generate configuration files.

Usage

>_ terminal

npx @snaplet/snapshot config generate

Command Flags

NameAliasDescriptionTypeChoicesDefault
--type-tstringtypedefs,transform,generate,keystypedefs
--dry-runbooleanfalse
--connection-stringThe connection string to use for introspecting the databasestring

list

The npx @snaplet/snapshot config list command is used to list config variables.

Usage

>_ terminal

npx @snaplet/snapshot config list

pull

The npx @snaplet/snapshot config pull command is used to pull cloud project config to local.

Usage

>_ terminal

npx @snaplet/snapshot config pull

Command Flags

NameAliasTypeChoicesDefault
--type-tstringconfig,typedefs,publicKeyconfig,typedefs,publicKey

push

The npx @snaplet/snapshot config push command is used to push local project config to cloud.

Usage

>_ terminal

npx @snaplet/snapshot config push

Command Flags

NameAliasTypeChoicesDefault
--type-tstringconfig,publicKeyconfig,publicKey

discord

The npx @snaplet/snapshot discord command is used to open the npx @snaplet/snapshot Discord chat window in your browser.

Usage

>_ terminal

npx @snaplet/snapshot discord

documentation

The npx @snaplet/snapshot documentation command is used to open the npx @snaplet/snapshot Documentation in your browser.

Usage

>_ terminal

npx @snaplet/snapshot documentation

setup

The npx @snaplet/snapshot project setup command is used to set up a project.

Usage

>_ terminal

npx @snaplet/snapshot project setup [project-id]

Command Args

NameDescriptionType
projectIdThe project idstring

generate

The npx @snaplet/snapshot generate command is used to:

  • regenerate the assets needed by @snaplet/seed
  • regenerate the typedefs needed for snaplet.config.ts.

npx @snaplet/snapshot will look at your database and generates a library that corresponds to your database structure. You would typically run this whenever you have changed your database structure, so that the assets used by @snaplet/seed correspond to your new database structure.

If you are familiar with @prisma/client (opens in a new tab), you can think of npx @snaplet/snapshot generate doing the same thing, just in this case for @snaplet/seed rather than @prisma/client.

Usage

>_ terminal

npx @snaplet/snapshot generate

Command Flags

NameDescriptionTypeDefault
--outputA custom directory path to output the generated assets tostring
--connection-stringThe connection string to use for introspecting the databasebooleanfalse

setup

The npx @snaplet/snapshot setup command is used to Initialize or connect an existing npx @snaplet/snapshot project.

Usage

>_ terminal

npx @snaplet/snapshot setup

snapshot

The npx @snaplet/snapshot snapshot command is used to manage snapshots.

Usage

>_ terminal

npx @snaplet/snapshot snapshot [action]

capture

The npx @snaplet/snapshot snapshot capture command is used to capture a new snapshot.

Usage

>_ terminal

npx @snaplet/snapshot snapshot capture [destination-path]

Command Flags

NameAliasDescriptionTypeChoices
--message-mAttach a message to the snapshotstring
--subset--subset-pathPath to a subset config filestring
--tagsAttach tags to the snapshotarray
--transform-mode-tTransformation mode to apply to the snapshotstringstrict,unsafe,auto

create

The npx @snaplet/snapshot snapshot create command is used to create a snapshot in cloud.

Usage

>_ terminal

npx @snaplet/snapshot snapshot create

Command Flags

NameTypeDefault
--jsonbooleanfalse

list

The npx @snaplet/snapshot snapshot list command is used to list all snapshots.

Usage

>_ terminal

npx @snaplet/snapshot snapshot list

Command Flags

NameType
--tagsarray

restore

The npx @snaplet/snapshot snapshot restore command is used to restore a snapshot.

Usage

>_ terminal

npx @snaplet/snapshot snapshot restore [snapshot-name|snapshot-path]

Command Args

NameDescriptionType
snapshot-namesnapshot-paththe unique name or path of the snapshot

Command Flags

NameAliasDescriptionTypeDeprecatedDefault
--dataRestore data on the database (skip with --no-data)booleantrue
--schemaRestore schema on the database (skip with --no-schema)booleantrue
--resetDrop destination database before restoring schemas (skip with --no-reset)booleantrue
--tagsFilter snapshots by tagsarray
--latestRestore the latest snapshotbooleanfalse
--yes-yPerforms a restore without a confirmation messagebooleanfalse
--tablesRestore only the specified tables to the target databasearray
--exclude-tablesExclude the specified tables from being restored to the target databasearray
--progressReport the restore progress into the terminal (silence with --no-progress)booleantrue

create

The npx @snaplet/snapshot team create command is used to create a new team.

Usage

>_ terminal

npx @snaplet/snapshot team create <name>

upgrade

The npx @snaplet/snapshot upgrade command is used to upgrade this binary.

Usage

>_ terminal

npx @snaplet/snapshot upgrade

completion

The npx @snaplet/snapshot completion command is used to generate completion script.

Usage

>_ terminal

npx @snaplet/snapshot completion