
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
mysql-schema
Advanced tools
Generate a JSON representing the schema of your MySQL database.
$ npm i -g mysql-schema
To generate schema definitions of MySQL databases automatically.
To abstract your code and repeat things the least possible.
When you care about the shape, content relies on you. Be water.
This tool enables you to generate a json
file representing your mysql
database.
This is a short explanation of how the CLI works.
$ mysql-schema
[--user] root # database user = process.env.DB_USER || 'root'
[--password] # database user password = process.env.DB_PASSWORD || ''
[--host] 127.0.0.1 # database host = process.env.DB_HOST || '127.0.0.1'
[--port] 3306 # database port = process.env.DB_PORT || 3306
[--database] test # database name = process.env.DB_NAME || 'test'
[--configurations] # database configurations file = process.env.DB_CONFIGURATIONS || false
[--extensions] # database schema extensions = process.env.DB_EXTENSIONS || false
[--as-json] # to generate a json & not a js = false
--output schema.{db}.js # output file = "schema.${database}.js"
This is a short explanation of how the API works.
require("mysql-schema").getSchema({
user: process.env.DB_USER || 'root',
password: process.env.DB_PASSWORD || '',
host: process.env.DB_HOST || '127.0.0.1',
port: process.env.DB_PORT || '3306',
database: process.env.DB_NAME || 'test',
configurations: process.env.DB_CONFIGURATIONS || false,
extensions: process.env.DB_EXTENSIONS || false,
asJson: false,
output: `./schema.${database}.js`
})
const MySQLSchema = require("mysql-schema")
Master class of the mysql-schema
API.
MySQLSchema.getSchema(options:Object):Promise<schema:Object>
Asynchronous.
Description: Generates a schema representing the MySQL database pointing.
Parameter: options
- object with properties (all of them optional):
user
: string
- user of the database
process.env.DB_USER
or "root"
password
: string
- password of the database
process.env.DB_PASSWORD
or ""
host
: string
- host of the database
process.env.DB_HOST
or "127.0.0.1"
port
: string
- port of the database
process.env.DB_PORT
or 3306
database
: string
- name of the database
process.env.DB_NAME
or "test"
configurations
: string
- configurations file for the database (overrides the other parameters)
process.env.DB_CONFIGURATIONS
or false
extensions
: string
- extensions file for the generation
process.env.DB_EXTENSIONS
or false
perTable
: filled with nested table, column, and extension properties.perColumn
: filled with nested column, and extension properties.general
: filled with extension properties.asJson
: boolean
- flag to output a json
instead of a js
file
false
output
: string
- destination of the file with the schema
process.env.DB_SCHEMA
or false
MySQLSchema.stringifyFn(value:Object, spaces:Number):String
Description: Like JSON.stringify
, but with a replacer that
converts to JavaScript instead, accepting Function
, RegExp
and Date
objects as native data.
Please, report issues and suggestions here.
This project is licensed under WTFPL or What The Fuck Public License, which means 'do what you want with it'.
FAQs
Generate a JSON representing the schema of your MySQL database.
The npm package mysql-schema receives a total of 12 weekly downloads. As such, mysql-schema popularity was classified as not popular.
We found that mysql-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.