forked from UKSOURCE/cms.hailearning.edu.vn
first commit
This commit is contained in:
28
models/migration.js
Normal file
28
models/migration.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const migrationSchema = new mongoose.Schema({
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true
|
||||
},
|
||||
batch: {
|
||||
type: Number,
|
||||
required: true,
|
||||
default: 1
|
||||
},
|
||||
ranAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
}
|
||||
}, {
|
||||
timestamps: true
|
||||
});
|
||||
|
||||
// Index để tìm kiếm nhanh
|
||||
migrationSchema.index({ name: 1 });
|
||||
migrationSchema.index({ batch: -1 });
|
||||
|
||||
module.exports = mongoose.model('Migration', migrationSchema);
|
||||
|
||||
Reference in New Issue
Block a user