sequelize-automate
Version:
Automatically generate bare sequelize models from your database.
127 lines (126 loc) • 3.24 kB
JSON
[
{
"modelName": "user_model",
"modelFileName": "user",
"tableName": "user",
"attributes": {
"id": {
"type": "DataTypes.INTEGER(11).UNSIGNED",
"allowNull": false,
"defaultValue": null,
"primaryKey": true,
"autoIncrement": true,
"comment": "primary ket",
"field": "id"
},
"name": {
"type": "DataTypes.STRING(100)",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "user name",
"field": "name",
"unique": "uk_name"
},
"email": {
"type": "DataTypes.STRING(255)",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "user email",
"field": "email"
},
"created_at": {
"type": "DataTypes.DATE",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "created datetime",
"field": "created_at"
},
"updated_at": {
"type": "DataTypes.DATE",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "updated datetime",
"field": "updated_at"
}
},
"indexes": []
},
{
"modelName": "user_post_model",
"modelFileName": "userPost",
"tableName": "user_post",
"attributes": {
"id": {
"type": "DataTypes.INTEGER(11).UNSIGNED",
"allowNull": false,
"defaultValue": null,
"primaryKey": true,
"autoIncrement": true,
"comment": "primary key",
"field": "id"
},
"user_id": {
"type": "DataTypes.INTEGER(11).UNSIGNED",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "user id",
"field": "user_id",
"references": { "key": "id", "model": "user_model" }
},
"title": {
"type": "DataTypes.STRING(255)",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "post title",
"field": "title"
},
"content": {
"type": "DataTypes.TEXT",
"allowNull": true,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "post content",
"field": "content"
},
"created_at": {
"type": "DataTypes.DATE",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "created datetime",
"field": "created_at"
},
"updated_at": {
"type": "DataTypes.DATE",
"allowNull": false,
"defaultValue": null,
"primaryKey": false,
"autoIncrement": false,
"comment": "updated datetime",
"field": "updated_at"
}
},
"indexes": [
{
"name": "fk_user_id",
"unique": false,
"type": "BTREE",
"fields": ["user_id"]
}
]
}
]