{"id":34582252,"url":"https://github.com/helvenk/egg-sequelize-auto","last_synced_at":"2025-12-24T10:10:47.460Z","repository":{"id":57220745,"uuid":"104991131","full_name":"helvenk/egg-sequelize-auto","owner":"helvenk","description":"Automatically generate bare sequelize models from your database, adjustment for egg","archived":false,"fork":false,"pushed_at":"2021-09-01T13:47:58.000Z","size":44,"stargazers_count":27,"open_issues_count":8,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-03T03:47:34.124Z","etag":null,"topics":["egg-plugin","javascript","sequelize-auto"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helvenk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-27T08:13:33.000Z","updated_at":"2024-04-16T18:03:19.000Z","dependencies_parsed_at":"2022-08-25T07:41:09.822Z","dependency_job_id":null,"html_url":"https://github.com/helvenk/egg-sequelize-auto","commit_stats":null,"previous_names":["lkspc/egg-sequelize-auto"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/helvenk/egg-sequelize-auto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helvenk%2Fegg-sequelize-auto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helvenk%2Fegg-sequelize-auto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helvenk%2Fegg-sequelize-auto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helvenk%2Fegg-sequelize-auto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helvenk","download_url":"https://codeload.github.com/helvenk/egg-sequelize-auto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helvenk%2Fegg-sequelize-auto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28000523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egg-plugin","javascript","sequelize-auto"],"created_at":"2025-12-24T10:10:46.900Z","updated_at":"2025-12-24T10:10:47.450Z","avatar_url":"https://github.com/helvenk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Egg-Sequelize-Auto\n\nAutomatically generate models for [egg-sequelize](https://github.com/eggjs/egg-sequelize) via the command line.\n\nNOTE: Egg-Sequelize-Auto is based on [Sequelize-Auto](https://github.com/sequelize/sequelize-auto).\n\n## Why Egg-Sequelize-Auto\n\n[Sequelize-Auto](https://github.com/sequelize/sequelize-auto)\nis a tool used to generate models for [Sequelize](https://github.com/sequelize/sequelize), which based on old `Sequelize` version 3.x.\n\nNow, `Sequelize v4` has breaking changes, we need a latest version of `Sequelize-Auto` which works in [Egg](https://github.com/eggjs/egg).\n\nSo we upgraded `Sequelize-Auto` to `Sequelize` v4 and adjusted it for [egg-sequelize](https://github.com/eggjs/egg-sequelize).\n\n## Install\n\n    npm install -g egg-sequelize-auto\n\n## Prerequisites\n\nYou will need to install the correct dialect binding globally before using egg-sequelize-auto.\n\nExample for MySQL/MariaDB\n\n`npm install -g mysql2`\n\nExample for Postgres\n\n`npm install -g pg pg-hstore`\n\nExample for Sqlite3\n\n`npm install -g sqlite3`\n\nExample for MSSQL\n\n`npm install -g mssql`\n\n## Usage\n\nWhen installed `egg-sequelize-auto`, you could use both `egg-sequelize-auto` and `sequlize-auto`.\n\nUsages are all the same, see [sequelize-auto's usage](https://github.com/sequelize/sequelize-auto#usage)\n\n## Example\n\n    egg-sequelize-auto -o \"./models\" -d test -h localhost -u root -p root -x my_password -e mysql\n\nProduces a file/files such as ./app/model/users.js which looks like:\n\n    /* indent size: 2 */\n\n    module.exports = app =\u003e {\n      const DataTypes = app.Sequelize;\n\n      const Model = app.model.define('Users', {\n        id: {\n          type: DataTypes.INTEGER(11),\n          allowNull: false,\n          primaryKey: true,\n          autoIncrement: true\n        },\n        username: {\n          type: DataTypes.STRING,\n          allowNull: true\n        },\n        touchedAt: {\n          type: DataTypes.DATE,\n          allowNull: true\n        },\n        aNumber: {\n          type: DataTypes.INTEGER(11),\n          allowNull: true\n        },\n        bNumber: {\n          type: DataTypes.INTEGER(11),\n          allowNull: true\n        },\n        validateTest: {\n          type: DataTypes.INTEGER(11),\n          allowNull: true\n        },\n        validateCustom: {\n          type: DataTypes.STRING,\n          allowNull: false\n        },\n        dateAllowNullTrue: {\n          type: DataTypes.DATE,\n          allowNull: true\n        },\n        defaultValueBoolean: {\n          type: DataTypes.BOOLEAN,\n          allowNull: true,\n          defaultValue: '1'\n        },\n        createdAt: {\n          type: DataTypes.DATE,\n          allowNull: false\n        },\n        updatedAt: {\n          type: DataTypes.DATE,\n          allowNull: false\n        }\n      }, {\n        tableName: 'Users',\n        freezeTableName: true\n      });\n\n      Model.associate = function (){\n\n      }\n\n      return Model;\n    };\n\n\n## Configuration options\n\nFor the `-c, --config` option the following JSON/configuration parameters are defined by Sequelize's `options` flag within the constructor. For more info:\n\n[http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor](http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html#instance-constructor-constructor)\n\n## Programmatic API\n\n```js\nconst EggSequelizeAuto = require('egg-sequelize-auto')\nconst auto = new EggSequelizeAuto'database', 'user', 'pass');\n\n// start \nauto.run(function (err) {\n  if (err) throw err;\n\n  console.log(auto.tables); // table list\n  console.log(auto.foreignKeys); // foreign key list\n});\n\n// With options:\nconst auto = new EggSequelizeAuto('database', 'user', 'pass', {\n    host: 'localhost',\n    dialect: 'mysql'|'mariadb'|'sqlite'|'postgres'|'mssql',\n    directory: false, // prevents the program from writing to disk\n    port: 'port',\n    additional: {\n        timestamps: false\n        //...\n    },\n    tables: ['table1', 'table2', 'table3']\n    //...\n})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelvenk%2Fegg-sequelize-auto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelvenk%2Fegg-sequelize-auto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelvenk%2Fegg-sequelize-auto/lists"}