chore: Server version bump from 11 to 12 for an autocommit (#40646)

## 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"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at:
<https://github.com/appsmithorg/appsmith/actions/runs/15038406686>
> Commit: de3f46bb37c29ebb91adc6fd8c82da6e284d5526
> Workflow: `PR Automation test suite`
> Tags: `@tag.All`
> Spec: ``
> <hr>Thu, 15 May 2025 06:43:48 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
This commit is contained in:
Manish Kumar 2025-05-15 13:24:10 +05:30 committed by GitHub
parent 6c8b040033
commit 9575cae6c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 33 additions and 3 deletions

View File

@ -26,7 +26,6 @@ public class LayoutExecutableUpdateDTO {
@JsonView(Views.Internal.class) @JsonView(Views.Internal.class)
Boolean executeOnLoad; Boolean executeOnLoad;
@Deprecated
@JsonView(Views.Public.class) @JsonView(Views.Public.class)
RunBehaviourEnum runBehaviour; RunBehaviourEnum runBehaviour;

View File

@ -106,7 +106,7 @@ public class ActionCE_DTO implements Identifiable, Executable {
* Use runBehaviour instead. * Use runBehaviour instead.
*/ */
@Deprecated @Deprecated
@JsonView({Views.Internal.class, FromRequest.class, Git.class}) @JsonView({Views.Internal.class, FromRequest.class})
Boolean executeOnLoad; Boolean executeOnLoad;
@JsonView({Views.Public.class, FromRequest.class, Git.class}) @JsonView({Views.Public.class, FromRequest.class, Git.class})

View File

@ -179,6 +179,18 @@ public class JsonSchemaMigration {
baseApplicationId, branchName, migratedJson)); baseApplicationId, branchName, migratedJson));
} }
applicationJson.setServerSchemaVersion(11); 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: default:
} }

View File

@ -4,7 +4,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class JsonSchemaVersionsFallback { public class JsonSchemaVersionsFallback {
private static final Integer serverVersion = 11; private static final Integer serverVersion = 12;
public static final Integer clientVersion = 2; public static final Integer clientVersion = 2;
public Integer getServerVersion() { public Integer getServerVersion() {

View File

@ -1366,4 +1366,23 @@ public class MigrationHelperMethods {
actionDatasource.setDatasourceConfiguration(datasourceConfiguration); actionDatasource.setDatasourceConfiguration(datasourceConfiguration);
} }
} }
public static void addRunBehaviourToApplicationJson(ApplicationJson applicationJson) {
List<NewAction> 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());
}
}
}
} }