sql >> Database teknologi >  >> RDS >> Mysql

Sådan får du Sequelize til at bruge enkeltstående tabelnavne

dokumenter angiv, at du kan bruge egenskaben freezeTableName .

Tag et kig på dette eksempel:

var Bar = sequelize.define('Bar', { /* bla */ }, {
  // don't add the timestamp attributes (updatedAt, createdAt)
  timestamps: false,

  // don't delete database entries but set the newly added attribute deletedAt
  // to the current date (when deletion was done). paranoid will only work if
  // timestamps are enabled
  paranoid: true,

  // don't use camelcase for automatically added attributes but underscore style
  // so updatedAt will be updated_at
  underscored: true,

  // disable the modification of tablenames; By default, sequelize will automatically
  // transform all passed model names (first parameter of define) into plural.
  // if you don't want that, set the following
  freezeTableName: true,

  // define the table's name
  tableName: 'my_very_custom_table_name'
})


  1. MySQL DROP DATABASE

  2. MySQL-ydelse:MyISAM vs InnoDB

  3. Sammenlægning af 3 tabeller/forespørgsler ved hjælp af MS Access Union Query

  4. Sådan forhindrer du opdateringer til en tabel, med en undtagelse for én situation