Skip to content

sqldef/sqldef-wasm

Repository files navigation

This is a wasm-compiled version of sqldef for easy use in JS.

usage

node/bun/etc

npm i sqldef
import sqldef from 'sqldef'

const sql1 = `
CREATE TABLE user (
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(128) DEFAULT 'konsumer'
) Engine=InnoDB DEFAULT CHARSET=utf8mb4;
`

const sql2 = `
CREATE TABLE user (
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(128) DEFAULT 'konsumer',
  created_at DATETIME NOT NULL
) Engine=InnoDB DEFAULT CHARSET=utf8mb4;
`

const output = await sqldef('mysql', sql1, sql2)

Supported types: mysql, sqlite3, mssql, postgres.

development

Normally, you should not need to do this stuff, but for local dev:

# build wasm
npm run build

# start a watching local web-server
# /sqldef is aliased to root-dir
npm start

# run all unit-tests
npm t

About

Simple wasm wrapper around sqldef for easy use with web/node/bun/deno

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published