add migrations table

This commit is contained in:
Alex Holliday committed 2025-09-23 11:34:25 -07:00
1 parent 11ff99613a
commit 0030394008
6 files changed
+72 -12

No files matched your search

+2
View File
@@ -5,3 +5,5 @@ export { Role } from "./auth/Role.js";
export type { IRole } from "./auth/Role.js";
export type { IInvite } from "./auth/Invite.js";
export { Invite } from "./auth/Invite.js";
export { Migration } from "./migration/Migration.js";
export type { IMigration } from "./migration/Migration.js";
@@ -0,0 +1,34 @@
import mongoose, { Schema, Document, Types } from "mongoose";
export interface IMigration extends Document {
_id: Types.ObjectId;
name: string;
runAt: Date;
success: boolean;
createdAt: Date;
updatedAt: Date;
}
const migrationSchema = new Schema<IMigration>(
{
name: {
type: String,
required: true,
},
runAt: {
type: Date,
required: false,
},
success: {
type: Boolean,
required: false,
},
},
{
timestamps: true,
}
);
migrationSchema.index({ name: 1 }, { unique: true });
export const Migration = mongoose.model<IMigration>("Migration", migrationSchema);