@iarayan/ch-orm
Version:
A Developer-First ClickHouse ORM with Powerful CLI Tools
73 lines • 2.93 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);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MigrationRecord = void 0;
const Types_1 = require("../../constants/Types");
const ModelDecorators_1 = require("../../decorators/ModelDecorators");
const Model_1 = require("../../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_1.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();
}
};
exports.MigrationRecord = MigrationRecord;
__decorate([
(0, ModelDecorators_1.Column)({
type: Types_1.DataTypes.STRING,
primary: true,
comment: "Name of the migration",
}),
__metadata("design:type", String)
], MigrationRecord.prototype, "name", void 0);
__decorate([
(0, ModelDecorators_1.Column)({
type: Types_1.DataTypes.UINT32,
comment: "Batch number of the migration",
}),
__metadata("design:type", Number)
], MigrationRecord.prototype, "batch", void 0);
__decorate([
(0, ModelDecorators_1.Column)({
type: Types_1.DataTypes.FLOAT64,
nullable: true,
comment: "Execution time of the migration in seconds",
}),
__metadata("design:type", Number)
], MigrationRecord.prototype, "execution_time", void 0);
__decorate([
(0, ModelDecorators_1.Column)({
type: Types_1.DataTypes.DATETIME,
comment: "Timestamp when the migration was created/applied",
}),
__metadata("design:type", Date)
], MigrationRecord.prototype, "created_at", void 0);
exports.MigrationRecord = MigrationRecord = __decorate([
(0, ModelDecorators_1.Table)("migrations")
], MigrationRecord);
//# sourceMappingURL=MigrationRecord.js.map