Registry / database / sql-ddl-sync

sql-ddl-sync

JSON →
library0.4.0jsnpmunverified

Node.js library for synchronizing SQL DDL schemas across MySQL, PostgreSQL, and SQLite. Version 0.4.0 is the latest stable release (no longer actively developed). It is part of the ORM2 ecosystem, used to automatically create, alter, or drop database tables to match defined model collections. Key differentiator: it handles schema migrations without manual SQL, but lacks documentation and is tied to the ORM2 driver interface.

npm install sql-ddl-sync
INSTALL
IMPORT
SIG · SQL-DDL-SYNC
S
sql-ddl-sync
databasejavascriptv0.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Sync
import { Sync } from 'sql-ddl-sync';
const Sync = require('sql-ddl-sync');
CommonJS require is supported. No default export; named export 'Sync' must be used.
Sync (type)
import type { Sync } from 'sql-ddl-sync';
import { Sync } from 'sql-ddl-sync';
TypeScript users should use type-only import if only using for types. However, the package does not ship TypeScript definitions.
Sync (require)
const { Sync } = require('sql-ddl-sync');
const Sync = require('sql-ddl-sync');
require returns an object with Sync as a property; destructuring is required.

Shows basic usage: connect ORM, define a collection, and synchronize to create table.

import { Sync } from 'sql-ddl-sync'; import orm from 'orm'; orm.connect('mysql://username:password@localhost/database', (err, db) => { if (err) throw err; const sync = new Sync({ dialect: 'mysql', driver: db.driver, debug: (text) => console.log('>', text) }); sync.defineCollection('users', { id: { type: 'serial', key: true }, name: { type: 'text', required: true }, email: { type: 'text' } }); sync.sync((err) => { if (err) console.error(err); else console.log('Sync done'); process.exit(0); }); });
Debug
Known issues
gotchaPackage requires ORM2 driver and is not standalone; must call sync() after defineCollection() or schema changes are not applied.
fix
Ensure you have orm installed and connect before using Sync.
affects: >=0.1.0
gotchaNo TypeScript definitions are provided; using in TypeScript may require custom declarations.
fix
Create a .d.ts file for Sync or use // @ts-ignore.
affects: *
Errors
Common errors & fixes
Cannot find module 'orm'
The package is not standalone; it depends on ORM2.
fix
npm install orm and the appropriate database driver (e.g., mysql).
TypeError: sync.sync is not a function
Sync was not instantiated correctly (missing 'new' or wrong import).
fix
Use: const sync = new Sync({...});
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Meta
1
OpenAI (training)
1
Resources
sql-ddl-sync — npm install sql-ddl-sync · libregistry