Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

db-knife

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-knife

`load.ts` is a CLI tool that allows you to

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Introduction

load.ts is a CLI tool that allows you to

  1. Load schemas from file system to a database
  2. Provide custom template to produce any command line operations

Note: Folder strucutre read by load.ts is not configurable as of today. It should be like

<database-server>/<database-name>/schema.sql

There can be multiple databases (database-name) inside a database-server folder. database-schema-examples repo follows this structure.

CLI Arguments Reference

ArgRequiredDescription
--foldertrueLoad a folder containing database schemas (making them available in templates) assuming the following structure. <dbname>/schema.sql. This is similar to database-schema-examples repo
--dbtrueConnection string of the database URL that will be parsed and made available as template args.
--subfoldersfalseComma separated, load selective folders from --folder
--templatefalseTemplate to produce output. See Template Variables below.
--datafalseAlso include data.sql (defaults to false, i.e. load.ts only picks schema.sql)

Template Variables

All examples are based on this connection string: sqlserver://localhost:1433;database=test;user=root;password=prisma;trustServerCertificate=true;encrypt=DANGER_PLAINTEXT

In all the examples below,

  1. Respective database is derived from the connection string provided in --db argument.
  2. Folder structure is assumed to be similar to database-schema-examples https://github.com/prisma/database-schema-examples/tree/main/mssql
NameDescriptionExample
'db_cli'Default CLI of the respective databasesqlcmd for SQL Server
'db_user_flag'User flag of the respective database-U for SQL Server
'db_pass_flag'Password flag of the respective database-P for SQL Server
'db_host_flag'Host flag of the respective database-S for SQL Server
'db_name_flag'Database name flag of the respective database-d for SQL Server
'db_file_flag'File input flag of the respective database-i for SQL Server
'db_eval_flag'Command line query flag of the respective database-Q for SQL Server
'db_quote'Quote delimiter used by the respective database' for SQL Server
'db_ignore_errors_flag'Flag to prompt database CLI to ignore any errors of the respective database
'db_user'User from the provided connection stringroot
'db_pass'Password from the provided connection stringprisma
'db_host'Host from the provided connection stringlocalhost
'db_name'Database name from the provided connection stringtest
'db_schema'Schema from the provided connection stringdbo (for SQL Server)
'file_path'schema.sql (or data.sql ) file path from the provided folderMultiple values for each schema.sql file in the given folder

FAQs

Package last updated on 23 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc