Gathering detailed insights and metrics for @fxjs/sql-ddl-sync
Gathering detailed insights and metrics for @fxjs/sql-ddl-sync
Gathering detailed insights and metrics for @fxjs/sql-ddl-sync
Gathering detailed insights and metrics for @fxjs/sql-ddl-sync
npm install @fxjs/sql-ddl-sync
Typescript
Module System
Node Version
NPM Version
74.1
Supply Chain
83.8
Quality
79
Maintenance
100
Vulnerability
97.9
License
JavaScript (56.95%)
TypeScript (43.05%)
Built with Next.js • Fully responsive • SEO optimized • Open source ready
Total Downloads
42,756
Last Day
1
Last Week
32
Last Month
175
Last Year
2,368
MIT License
3 Stars
570 Commits
5 Forks
6 Watchers
17 Branches
7 Contributors
Updated on Apr 19, 2025
Latest Version
0.11.7
Package Id
@fxjs/sql-ddl-sync@0.11.7
Unpacked Size
106.97 kB
Size
17.78 kB
File Count
29
NPM Version
lerna/5.5.4/node@v18.18.2+x64 (win32)
Node Version
18.18.2
Published on
Apr 19, 2025
Cumulative downloads
Total Downloads
Last Day
-90%
1
Compared to previous day
Last Week
-31.9%
32
Compared to previous week
Last Month
50.9%
175
Compared to previous month
Last Year
-14.3%
2,368
Compared to previous year
3
2
NOTICE: This is node-sql-ddl-sync's fibjs version, thx a lot to node-sql-ddl-sync's author : )
1npm install @fxjs/sql-ddl-sync
Originally, this module is part of @fxjs/orm. It's used synchronize model tables in supported dialects.
But now, it could run without @fxjs/orm, just install @fxjs/db-driver instead 🚀 Sorry there is no API documentation for now but there are a couple of tests you can read and find out how to use it if you want.
Version Match
sql-ddl-sync Version | required orm Version |
---|---|
sql-ddl-sync <= 0.3.x | orm < 1.10.3 |
sql-ddl-sync = 0.4.x | orm >= 1.10.3 |
sql-ddl-sync >= 0.5.x | don't need! |
Install @fxjs/db-driver. Create a file with the contents below and change insert your database credentials.
Run once and you'll see table ddl_sync_test
appear in your database. Then make some changes to it (add/drop/change columns)
and run the code again. Your table should always return to the same structure.
1const DBDriver = require("@fxjs/db-driver"); 2const mysql = require("mysql"); 3const Sync = require("@fxjs/sql-ddl-sync").Sync; 4 5const dbdriver = DBDriver.create("mysql://username:password@localhost/database"); 6 7const sync = new Sync({ 8 dbdriver: dbdriver, 9 debug : function (text) { 10 console.log("> %s", text); 11 } 12}); 13 14sync.defineCollection("ddl_sync_test", { 15 id : { type: "serial", key: true, serial: true }, 16 name : { type: "text", required: true }, 17 age : { type: "integer" }, 18 male : { type: "boolean" }, 19 born : { type: "date", time: true }, 20 born2 : { type: "date" }, 21 int2 : { type: "integer", size: 2 }, 22 int4 : { type: "integer", size: 4 }, 23 int8 : { type: "integer", size: 8 }, 24 float4 : { type: "number", size: 4 }, 25 float8 : { type: "number", size: 8 }, 26 photo : { type: "binary" } 27}); 28 29try { 30 sync.sync() 31 console.log("> Sync Done"); 32} catch (err) { 33 if (err) { 34 console.log("> Sync Error"); 35 console.log(err); 36 } 37} 38 39process.exit(0);
To test, first make sure you have development dependencies installed. Go to the root folder and do:
1npm install
Then, just run the tests.
1npm test
If you have a supported database server and want to test against it, first install the module:
And then run:
1URI=mysql://username:password@localhost/database fibjs test/run-db
This repo is checked out from Diogo Resende's node-sql-ddl-sync, which is one part of orm
, and orm is the original source of @fxjs/orm
. Thx a lot to him and his partner.
No vulnerabilities found.