update
This commit is contained in:
20
models/Room.js
Normal file
20
models/Room.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../config/database');
|
||||
|
||||
const Room = sequelize.define('rooms', {
|
||||
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
|
||||
room_code: { type: DataTypes.STRING(20), allowNull: false },
|
||||
room_name: { type: DataTypes.STRING(100), allowNull: false },
|
||||
school_id: { type: DataTypes.UUID, allowNull: false },
|
||||
room_type: { type: DataTypes.ENUM('classroom', 'lab', 'library', 'gym', 'other') },
|
||||
capacity: { type: DataTypes.INTEGER },
|
||||
floor: { type: DataTypes.INTEGER },
|
||||
created_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
||||
updated_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
||||
}, {
|
||||
tableName: 'rooms',
|
||||
timestamps: true,
|
||||
underscored: true,
|
||||
});
|
||||
|
||||
module.exports = Room;
|
||||
Reference in New Issue
Block a user