@iarayan/ch-orm
Version:
A Developer-First ClickHouse ORM with Powerful CLI Tools
70 lines • 2.62 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { DataTypes } from "../../constants/Types";
import { Column, Table } from "../../decorators/ModelDecorators";
import { Model } from "../../model/Model";
/**
* Model representing a migration record in the migrations table
* Used to track which migrations have been applied to the database
*/
let MigrationRecord = class MigrationRecord extends Model {
constructor() {
super(...arguments);
/**
* Name of the migration
* Typically the class name of the migration
*/
this.name = "";
/**
* Batch number of the migration
* Migrations are grouped in batches for easier rollback
*/
this.batch = 0;
/**
* Timestamp when the migration was created/applied
*/
this.created_at = new Date();
}
};
__decorate([
Column({
type: DataTypes.STRING,
primary: true,
comment: "Name of the migration",
}),
__metadata("design:type", String)
], MigrationRecord.prototype, "name", void 0);
__decorate([
Column({
type: DataTypes.UINT32,
comment: "Batch number of the migration",
}),
__metadata("design:type", Number)
], MigrationRecord.prototype, "batch", void 0);
__decorate([
Column({
type: DataTypes.FLOAT64,
nullable: true,
comment: "Execution time of the migration in seconds",
}),
__metadata("design:type", Number)
], MigrationRecord.prototype, "execution_time", void 0);
__decorate([
Column({
type: DataTypes.DATETIME,
comment: "Timestamp when the migration was created/applied",
}),
__metadata("design:type", Date)
], MigrationRecord.prototype, "created_at", void 0);
MigrationRecord = __decorate([
Table("migrations")
], MigrationRecord);
export { MigrationRecord };
//# sourceMappingURL=MigrationRecord.js.map