Gathering detailed insights and metrics for egg-sequelize-auto
Gathering detailed insights and metrics for egg-sequelize-auto
Gathering detailed insights and metrics for egg-sequelize-auto
Gathering detailed insights and metrics for egg-sequelize-auto
egg-mysql-sequelize-auto
Automatically generate mysql sequelize models for Egg.js framework from your database.
egg-sequelize-models-auto
Automatically generate bare sequelize models from your database, adjustment for egg
egg-sequelize-autotrx
Auto transaction based on cls-hooked for egg-sequelize plugin
egg-sequelize-auto-zm
这个包基于egg-sequelize-auto 主要解决了主键没有自动递增和备注不自动同步的bug
Automatically generate bare sequelize models from your database, adjustment for egg
npm install egg-sequelize-auto
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
27 Stars
13 Commits
15 Forks
2 Watchers
1 Branches
1 Contributors
Updated on Apr 16, 2024
Latest Version
0.1.1
Package Id
egg-sequelize-auto@0.1.1
Size
25.24 kB
NPM Version
5.0.3
Node Version
8.1.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Automatically generate models for egg-sequelize via the command line.
NOTE: Egg-Sequelize-Auto is based on Sequelize-Auto.
Sequelize-Auto
is a tool used to generate models for Sequelize, which based on old Sequelize
version 3.x.
Now, Sequelize v4
has breaking changes, we need a latest version of Sequelize-Auto
which works in Egg.
So we upgraded Sequelize-Auto
to Sequelize
v4 and adjusted it for egg-sequelize.
npm install -g egg-sequelize-auto
You will need to install the correct dialect binding globally before using egg-sequelize-auto.
Example for MySQL/MariaDB
npm install -g mysql2
Example for Postgres
npm install -g pg pg-hstore
Example for Sqlite3
npm install -g sqlite3
Example for MSSQL
npm install -g mssql
When installed egg-sequelize-auto
, you could use both egg-sequelize-auto
and sequlize-auto
.
Usages are all the same, see sequelize-auto's usage
egg-sequelize-auto -o "./models" -d test -h localhost -u root -p root -x my_password -e mysql
Produces a file/files such as ./app/model/users.js which looks like:
/* indent size: 2 */
module.exports = app => {
const DataTypes = app.Sequelize;
const Model = app.model.define('Users', {
id: {
type: DataTypes.INTEGER(11),
allowNull: false,
primaryKey: true,
autoIncrement: true
},
username: {
type: DataTypes.STRING,
allowNull: true
},
touchedAt: {
type: DataTypes.DATE,
allowNull: true
},
aNumber: {
type: DataTypes.INTEGER(11),
allowNull: true
},
bNumber: {
type: DataTypes.INTEGER(11),
allowNull: true
},
validateTest: {
type: DataTypes.INTEGER(11),
allowNull: true
},
validateCustom: {
type: DataTypes.STRING,
allowNull: false
},
dateAllowNullTrue: {
type: DataTypes.DATE,
allowNull: true
},
defaultValueBoolean: {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: '1'
},
createdAt: {
type: DataTypes.DATE,
allowNull: false
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false
}
}, {
tableName: 'Users',
freezeTableName: true
});
Model.associate = function (){
}
return Model;
};
For the -c, --config
option the following JSON/configuration parameters are defined by Sequelize's options
flag within the constructor. For more info:
http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor
1const EggSequelizeAuto = require('egg-sequelize-auto') 2const auto = new EggSequelizeAuto'database', 'user', 'pass'); 3 4// start 5auto.run(function (err) { 6 if (err) throw err; 7 8 console.log(auto.tables); // table list 9 console.log(auto.foreignKeys); // foreign key list 10}); 11 12// With options: 13const auto = new EggSequelizeAuto('database', 'user', 'pass', { 14 host: 'localhost', 15 dialect: 'mysql'|'mariadb'|'sqlite'|'postgres'|'mssql', 16 directory: false, // prevents the program from writing to disk 17 port: 'port', 18 additional: { 19 timestamps: false 20 //... 21 }, 22 tables: ['table1', 'table2', 'table3'] 23 //... 24})
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
42 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More