diff --git a/plm-api/src/app.js b/plm-api/src/app.js index f3cdc8e..b52ff81 100644 --- a/plm-api/src/app.js +++ b/plm-api/src/app.js @@ -44,13 +44,12 @@ const initializeServer = async () => { // 데이터베이스 연결 대기 await waitForDatabase(); - // // 개발 환경에서만 데이터베이스 동기화 - // if (process.env.NODE_ENV !== "production") { - // await sequelize.sync({ force: true }); - // // await sequelize.sync({ alter: true }); - // logger.info("Database synchronized."); - // await require("./utils/createInitialAdmin")(); - // } + // 개발 환경에서만 데이터베이스 동기화 + if (process.env.NODE_ENV !== "production") { + await sequelize.sync({ alert: true }); + logger.info("Database synchronized."); + //await require("./utils/createInitialAdmin")(); + } // 서버 시작 const port = config.port; diff --git a/plm-api/src/models/OemMng.js b/plm-api/src/models/OemMng.js new file mode 100644 index 0000000..572c18a --- /dev/null +++ b/plm-api/src/models/OemMng.js @@ -0,0 +1,55 @@ +// models/OemMng.js + +const { Model, DataTypes } = require("sequelize"); + +class OemMng extends Model { + static init(sequelize) { + super.init( + { + id: { + type: DataTypes.UUID, + defaultValue: DataTypes.UUIDV4, + primaryKey: true, + }, + oem_code: { + type: DataTypes.STRING(64), + allowNull: true, + }, + oem_name: { + type: DataTypes.STRING(64), + allowNull: true, + }, + writer: { + type: DataTypes.STRING(32), + allowNull: true, + }, + regdate: { + type: DataTypes.DATE, + allowNull: true, + }, + status: { + type: DataTypes.STRING(32), + allowNull: true, + }, + oem_no: { + type: DataTypes.STRING(32), + allowNull: true, + }, + }, + { + sequelize, + modelName: 'OemMng', + tableName: 'oem_mng1', + timestamps: true, + indexes: [ + { + fields: ['id'], + }, + ], + } + ); + return this; + } +} + +module.exports = OemMng; \ No newline at end of file