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 CaptureSpan from "../../../Utils/Telemetry/CaptureSpan";
export class MigrationName1717678334852 {
    constructor() {
        this.name = "MigrationName1717678334852";
    }
    async up(queryRunner) {
        // check if the column exists
        const apiKeyPermissionTable = await queryRunner.getTable("ApiKeyPermission");
        if (apiKeyPermissionTable) {
            const isBlockPermissionColumn = apiKeyPermissionTable.columns.find((column) => {
                return column.name === "isBlockPermission";
            });
            if (!isBlockPermissionColumn) {
                await queryRunner.query(`ALTER TABLE "ApiKeyPermission" ADD "isBlockPermission" boolean NOT NULL DEFAULT false`);
            }
        }
        // check if the column exists
        const teamPermissionTable = await queryRunner.getTable("TeamPermission");
        if (teamPermissionTable) {
            const isBlockPermissionColumn = teamPermissionTable.columns.find((column) => {
                return column.name === "isBlockPermission";
            });
            if (!isBlockPermissionColumn) {
                await queryRunner.query(`ALTER TABLE "TeamPermission" ADD "isBlockPermission" boolean NOT NULL DEFAULT false`);
            }
        }
    }
    async down(queryRunner) {
        await queryRunner.query(`ALTER TABLE "TeamPermission" DROP COLUMN "isBlockPermission"`);
        await queryRunner.query(`ALTER TABLE "ApiKeyPermission" DROP COLUMN "isBlockPermission"`);
    }
}
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], MigrationName1717678334852.prototype, "up", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", Promise)
], MigrationName1717678334852.prototype, "down", null);
//# sourceMappingURL=1717678334852-MigrationName.js.map