Gathering detailed insights and metrics for egg-mysql-sequelize-auto
Gathering detailed insights and metrics for egg-mysql-sequelize-auto
npm install egg-mysql-sequelize-auto
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (92.15%)
JavaScript (7.85%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
3,635
Last Day
1
Last Week
28
Last Month
120
Last Year
1,579
1 Stars
18 Commits
2 Forks
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.1.0
Package Id
egg-mysql-sequelize-auto@1.1.0
Unpacked Size
36.59 kB
Size
8.67 kB
File Count
22
NPM Version
8.11.0
Node Version
16.15.1
Cumulative downloads
Total Downloads
Last day
-50%
1
Compared to previous day
Last week
-3.4%
28
Compared to previous week
Last month
-16.1%
120
Compared to previous month
Last year
296.7%
1,579
Compared to previous year
6
Automatically generate models for SequelizeJS & Egg.js framework via command line (Typescript version only).
Read this in other languages: 简体中文
npm install egg-mysql-sequelize-auto --save-dev
mysql-sequelize-auto -h <host> -d <database> -p [port] -u <user> -x [password] -o [./path/to/model] -t [tableName]
Options:
-h, --host IP/Hostname for the database. [string]
-d, --database Database name. [string] [required]
-u, --user Username for database. [string] [required]
-x, --pass Password for database. [string] [required]
-p, --port Port number for database. Ex: 3306 [number]
-o, --output What directory to place the models. [string]
-t, --tables table name to import [string] [required]
-f, --over-write Force to overwrite existed model files [boolean]
1"scripts": { 2 "model": "mysql-sequelize-auto -h 127.0.0.1 -d database_name -p 3306 -u user -x password -o './app/model' -t table_name" 3}
npm run model
1"scripts": { 2 "model": "mysql-sequelize-auto -h 127.0.0.1 -d database_name -p 3306 -u user -x password -o './app/model'" 3}
npm run model -- --t=table_name
1CREATE TABLE `test_table` ( 2 `id` INT NOT NULL AUTO_INCREMENT, 3 `key` VARCHAR(30) NOT NULL COMMENT 'Article key', 4 `title` VARCHAR(100) NOT NULL COMMENT 'Article title', 5 `content` TEXT NOT NULL COMMENT 'Article content', 6 `created_time` DATETIME NOT NULL COMMENT 'Created time', 7 `updated_time` DATETIME NOT NULL COMMENT 'Updated time', 8 `removed` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Flag of soft deletion', 9 PRIMARY KEY (`id`));
/model/TestTable.ts
1import { Application } from 'egg'; 2import { TestTable } from './define/TestTable'; 3 4export default function(app: Application) { 5 const { DataTypes } = app.Sequelize; 6 7 const ExportModel = app.model.define<TestTable, any>('TestTable', 8 { 9 id: { 10 autoIncrement: true, 11 primaryKey: true, 12 allowNull: false, 13 type: DataTypes.INTEGER, 14 comment: "" 15 }, 16 key: { 17 allowNull: false, 18 type: DataTypes.STRING(30), 19 comment: "Article key" 20 }, 21 title: { 22 allowNull: false, 23 type: DataTypes.STRING(100), 24 comment: "Article title" 25 }, 26 content: { 27 allowNull: false, 28 type: DataTypes.TEXT, 29 comment: "Article content" 30 }, 31 created_time: { 32 allowNull: false, 33 type: DataTypes.DATE, 34 comment: "Created time" 35 }, 36 updated_time: { 37 allowNull: false, 38 type: DataTypes.DATE, 39 comment: "Updated time" 40 }, 41 removed: { 42 allowNull: false, 43 type: DataTypes.TINYINT, 44 defaultValue: 0, 45 comment: "Flag of soft deletion" 46 } 47} 48 , { 49 timestamps: false, // 去除createAt updateAt 50 freezeTableName: true, // 使用自定义表名 51 tableName: 'test_table', 52 }); 53 54 return ExportModel; 55 56}
/model/define/TestTable.d.ts
1import { Model, CreationAttributes } from 'sequelize'; 2 3interface TestTableAttributes 4 { 5 id?: number; 6 key?: string; 7 title?: string; 8 content?: string; 9 created_time?: Date; 10 updated_time?: Date; 11 removed?: number 12} 13 14class TestTable extends Model<TestTableAttributes, CreationAttributes> implements TestTableAttributes 15 { 16 id?: number; 17 key?: string; 18 title?: string; 19 content?: string; 20 created_time?: Date; 21 updated_time?: Date; 22 removed?: number 23} 24 25export { TestTableAttributes, TestTable };
Sequelize-Auto (Borrowed some code from Sequelize-Auto)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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