import { Dt as childLogger } from "./module-i2pKz8s3.mjs";
import "./upgrade-manifest-yO_IhKsW.mjs";
import "./v1-CIo7r_2a.mjs";
import "./chunk-VBDAOXYI-pscb2NCq.mjs";
import "./vetra-cloud-environment-DjJ0ZUB9.mjs";
import { t as VetraCloudEnvironmentProcessor } from "./vetra-cloud-environment-hUdjh6pX.mjs";
//#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--721o8Ir.mjs.map