cyjake / leoric

👑 JavaScript ORM for MySQL, PostgreSQL, and SQLite.

Home Page:https://leoric.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] Model.timestamps didn't init correct while use `static attributes` to define a model

JimmyDaddy opened this issue · comments

 class Book extends Bone {
    static attributes = {
      isbn: { type: BIGINT, primaryKey: true },
      name: { type: STRING, allowNull: false },
      price: { type: DECIMAL(10, 3), allowNull: false },
      created_at: { type: DATE },
      updated_at: { type: DATE },
      deleted_at: { type: DATE },
    }
  }
console.log(Book.timestamps);
// {}

class Book extends Bone {
  static attributes = {
    isbn: { type: BIGINT, primaryKey: true },
    name: { type: STRING, allowNull: false },
    price: { type: DECIMAL(10, 3), allowNull: false },
    createdAt: { type: DATE },
    updated_at: { type: DATE },
    deleted_at: { type: DATE },
  }
}
console.log(Book.timestamps);
// { createdAt: 'createdAt' }