LoginSignup
9
7

More than 5 years have passed since last update.

Sequelize.js でデータベースのカラムを変更せずに model を定義

Posted at
sequelize.define

の時点で次を設定

  • テーブル名を変更しない。
    • freezeTableName: true
    • tableName: "既存のテーブル名"
  • createdAt, updatedAt を追加しない
    • timestamps: false
  • id を追加しない
    • 主キーに対応するカラムに primaryKey: true 追加

これでテーブルのスキーマが as is で使える。

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7