import { Dt as childLogger } from "./module-CkyheTUC.js";
import "./upgrade-manifest-DRHIsqIt.js";
import "./v1-BBlaTkyo.js";
import "./chunk-VBDAOXYI-mc9LB-NX.js";
import { t as VetraCloudEnvironmentProcessor } from "./vetra-cloud-environment-YyVSJKe9.js";
//#region processors/vetra-cloud-environment/migrations.ts
async function up(db) {
	await db.schema.createTable("environments").addColumn("id", "varchar(255)").addColumn("name", "varchar(255)").addColumn("subdomain", "varchar(255)").addColumn("tenantId", "varchar(255)").addColumn("customDomain", "varchar(255)").addColumn("packages", "text").addColumn("services", "text").addColumn("status", "varchar(50)").addPrimaryKeyConstraint("environments_pkey", ["id"]).ifNotExists().execute();
	for (const column of [
		"subdomain",
		"tenantId",
		"customDomain"
	]) try {
		await db.schema.alterTable("environments").addColumn(column, "varchar(255)").execute();
	} catch {}
	try {
		await db.schema.alterTable("environments").dropColumn("domain").execute();
	} catch {}
}
//#endregion
//#region processors/vetra-cloud-environment/factory.ts
const logger = childLogger(["vetra-cloud-environment-factory"]);
const vetraCloudEnvironmentProcessorFactory = (module) => async (driveHeader) => {
	logger.info(`Creating processor for drive ${driveHeader.id}`);
	const db = await module.relationalDb.createNamespace("vetra-cloud-environments");
	await up(db);
	return [{
		processor: new VetraCloudEnvironmentProcessor(db, module.reactorClient),
		filter: {
			branch: ["main"],
			documentId: ["*"],
			documentType: ["powerhouse/vetra-cloud-environment", "powerhouse/document-drive"],
			scope: ["global"]
		}
	}];
};
//#endregion
export { vetraCloudEnvironmentProcessorFactory };

//# sourceMappingURL=factory-DwANTrKL.js.map