sequelize-automate
Version:
Automatically generate bare sequelize models from your database.
8 lines (7 loc) • 1.53 kB
JSON
[
{
"file": "user.js",
"code": "const {\n DataTypes\n} = require('sequelize');\n\nmodule.exports = sequelize => {\n const attributes = {\n id: {\n type: DataTypes.INTEGER(11).UNSIGNED,\n allowNull: false,\n defaultValue: null,\n primaryKey: true,\n autoIncrement: true,\n comment: \"primary ket\",\n field: \"id\"\n },\n name: {\n type: DataTypes.STRING(100),\n allowNull: false,\n defaultValue: null,\n primaryKey: false,\n autoIncrement: false,\n comment: \"user name\",\n field: \"name\",\n unique: \"uk_name\"\n },\n email: {\n type: DataTypes.STRING(255),\n allowNull: false,\n defaultValue: null,\n primaryKey: false,\n autoIncrement: false,\n comment: \"user email\",\n field: \"email\"\n },\n created_at: {\n type: DataTypes.DATE,\n allowNull: false,\n defaultValue: null,\n primaryKey: false,\n autoIncrement: false,\n comment: \"created datetime\",\n field: \"created_at\"\n },\n updated_at: {\n type: DataTypes.DATE,\n allowNull: false,\n defaultValue: null,\n primaryKey: false,\n autoIncrement: false,\n comment: \"updated datetime\",\n field: \"updated_at\"\n }\n };\n const options = {\n tableName: \"user\",\n comment: \"\",\n indexes: []\n };\n const UserModel = sequelize.define(\"user_model\", attributes, options);\n return UserModel;\n};",
"fileType": "model"
}
]