sequelize-auto icon indicating copy to clipboard operation
sequelize-auto copied to clipboard

Simplification proposal for the output formats.

Open adminy opened this issue 2 years ago • 1 comments

Suppose instead of es5, es6, esm, ts types, it outputted this json structure:

[
  {
    "tableName": "models"
  },
  {
    "id": {
      "type": "DataTypes.INTEGER(11)",
      "allowNull": false,
      "primaryKey": true,
      "comment": "null",
      "autoIncrement": true
    },
    "dbname": {
      "type": "DataTypes.STRING(45)",
      "allowNull": false,
      "autoIncrement": false,
      "comment": "null"
    },
    "tablename": {
      "type": "DataTypes.STRING(45)",
      "allowNull": false,
      "autoIncrement": false,
      "comment": "null"
    },
    "weekday": {
      "type": "DataTypes.ENUM(\"Sun\",\"Mon\",\"Tues\",\"Wed\",\"Thur\",\"Fri\",\"Sat\")",
      "allowNull": false,
      "autoIncrement": false,
      "comment": "null"
    },
    "createdDate": {
      "type": "DataTypes.DATE",
      "allowNull": true,
      "defaultValue": "CURRENT_TIMESTAMP",
      "autoIncrement": false,
      "comment": "null"
    }
  }
]

Which makes it easy for you to simply Sequelize.import it.

It is a more convenient and useful from any js version to use the json format rather than version specific javascript code.

adminy avatar Aug 26 '23 01:08 adminy

This is a good idea. I forked sequelize-auto I'd like to try this.

siniradam avatar Apr 26 '24 07:04 siniradam