From 980d45a524d6a06c8a67c021e28d65d31e4bc4b7 Mon Sep 17 00:00:00 2001 From: Joe Fabisevich Date: Thu, 20 Nov 2025 20:52:50 -0500 Subject: [PATCH] Adding more build expressions for MigrationBuilder --- Sources/Monarch/MigrationBuilder.swift | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Sources/Monarch/MigrationBuilder.swift b/Sources/Monarch/MigrationBuilder.swift index 60c7722..33af986 100644 --- a/Sources/Monarch/MigrationBuilder.swift +++ b/Sources/Monarch/MigrationBuilder.swift @@ -3,4 +3,37 @@ public struct MigrationBuilder { public static func buildBlock(_ migrations: Migration...) -> [Migration] { return migrations } + + public static func buildBlock(_ migrations: [Migration]...) -> [Migration] { + migrations.flatMap { $0 } + } + + public static func buildExpression(_ expression: Migration) -> [Migration] { + [expression] + } + + public static func buildExpression(_ expression: [Migration]) -> [Migration] { + expression + } + + public static func buildOptional(_ migration: [Migration]?) -> [Migration] { + migration ?? [] + } + + public static func buildEither(first migration: [Migration]) -> [Migration] { + migration + } + + public static func buildEither(second migration: [Migration]) -> [Migration] { + migration + } + + public static func buildArray(_ migrations: [[Migration]]) -> [Migration] { + migrations.flatMap { $0 } + } + + public static func buildLimitedAvailability(_ migration: [Migration]) -> [Migration] { + migration + } + } -- 2.51.2