From 9575cae6c6bb391d8a3f9a9b82af7bdc0c5ab4a4 Mon Sep 17 00:00:00 2001 From: Manish Kumar <107841575+sondermanish@users.noreply.github.com> Date: Thu, 15 May 2025 13:24:10 +0530 Subject: [PATCH] chore: Server version bump from 11 to 12 for an autocommit (#40646) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description - Added server bump from 11 to 12 to support an autocommit for git directory structural change Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!IMPORTANT] > 🟣 🟣 🟣 Your tests are running. > Tests running at: > Commit: de3f46bb37c29ebb91adc6fd8c82da6e284d5526 > Workflow: `PR Automation test suite` > Tags: `@tag.All` > Spec: `` >
Thu, 15 May 2025 06:43:48 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Improved handling of application structure during schema migration, enabling better organization of source modules by package. - **Improvements** - Enhanced support for autocommit of structural changes in the git directory. - Updated schema version to ensure compatibility with the latest migration. - **Deprecation** - Removed deprecated status from the run behaviour field in layout updates. - **Other Changes** - Adjusted visibility of certain fields for improved data handling and migration consistency. --------- Co-authored-by: “sneha122” <“sneha@appsmith.com”> --- .../dtos/LayoutExecutableUpdateDTO.java | 1 - .../external/models/ce/ActionCE_DTO.java | 2 +- .../migrations/JsonSchemaMigration.java | 12 ++++++++++++ .../JsonSchemaVersionsFallback.java | 2 +- .../migrations/MigrationHelperMethods.java | 19 +++++++++++++++++++ 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/LayoutExecutableUpdateDTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/LayoutExecutableUpdateDTO.java index d79512893a..9ddd23ea36 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/LayoutExecutableUpdateDTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/LayoutExecutableUpdateDTO.java @@ -26,7 +26,6 @@ public class LayoutExecutableUpdateDTO { @JsonView(Views.Internal.class) Boolean executeOnLoad; - @Deprecated @JsonView(Views.Public.class) RunBehaviourEnum runBehaviour; diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java index 4de0347a1e..337dcb396d 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java @@ -106,7 +106,7 @@ public class ActionCE_DTO implements Identifiable, Executable { * Use runBehaviour instead. */ @Deprecated - @JsonView({Views.Internal.class, FromRequest.class, Git.class}) + @JsonView({Views.Internal.class, FromRequest.class}) Boolean executeOnLoad; @JsonView({Views.Public.class, FromRequest.class, Git.class}) diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java index 8d72075c6a..a57e4f3b64 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaMigration.java @@ -179,6 +179,18 @@ public class JsonSchemaMigration { baseApplicationId, branchName, migratedJson)); } applicationJson.setServerSchemaVersion(11); + case 11: + // This server version bump has been made to support an autocommit for + // structural changes to the git directory. This change refactors + // source modules from source modules directory to subdirectories named after + // packages of the respective modules. + // I.e., source modules/module1.json -> source modules/package1/module1.json + migrateApplicationJsonMono = migrateApplicationJsonMono.map(migratedJson -> { + MigrationHelperMethods.addRunBehaviourToApplicationJson(migratedJson); + return migratedJson; + }); + + applicationJson.setServerSchemaVersion(12); default: } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java index 14a2735550..1ac86013c9 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/JsonSchemaVersionsFallback.java @@ -4,7 +4,7 @@ import org.springframework.stereotype.Component; @Component public class JsonSchemaVersionsFallback { - private static final Integer serverVersion = 11; + private static final Integer serverVersion = 12; public static final Integer clientVersion = 2; public Integer getServerVersion() { diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java index c361a99812..a01b4c0ebe 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/MigrationHelperMethods.java @@ -1366,4 +1366,23 @@ public class MigrationHelperMethods { actionDatasource.setDatasourceConfiguration(datasourceConfiguration); } } + + public static void addRunBehaviourToApplicationJson(ApplicationJson applicationJson) { + List actionList = applicationJson.getActionList(); + if (CollectionUtils.isNullOrEmpty(actionList)) { + return; + } + + for (NewAction action : actionList) { + if (action.getUnpublishedAction() != null) { + ActionDTO actionDTO = action.getUnpublishedAction(); + actionDTO.setRunBehaviour(actionDTO.getRunBehaviour()); + } + + if (action.getPublishedAction() != null) { + ActionDTO actionDTO = action.getPublishedAction(); + actionDTO.setRunBehaviour(actionDTO.getRunBehaviour()); + } + } + } }