Skip to content

chore: Add spotless for pg migrations#37105

Merged
AnaghHegde merged 3 commits intopgfrom
chore/spotless
Nov 11, 2024
Merged

chore: Add spotless for pg migrations#37105
AnaghHegde merged 3 commits intopgfrom
chore/spotless

Conversation

@AnaghHegde
Copy link
Contributor

@AnaghHegde AnaghHegde commented Oct 25, 2024

Description

Apply spotless to maintain checksum values same across all developers machine for flyway.

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD a0906b3 yet


Fri, 25 Oct 2024 12:24:39 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added clearer instructions in SQL templates for entering valid table names.
  • Bug Fixes

    • Improved formatting of SQL statements for better readability across various templates.
  • Chores

    • Configured the project to include SQL files in the formatting process using the Spotless plugin.
  • Documentation

    • Added comments and adjusted formatting in the application.properties file for clarity.

@AnaghHegde AnaghHegde self-assigned this Oct 25, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 25, 2024

Walkthrough

The changes in this pull request involve formatting adjustments across multiple SQL files within various plugins. Key modifications include realigning indentation for SQL statements, adding comments for clarity, and ensuring consistent formatting for readability. Specific files have had SQL commands adjusted for better alignment, while others have had comments added or newline characters introduced without altering the underlying logic or functionality.

Changes

File Path Change Summary
app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/*.sql Adjusted indentation for INSERT and UPDATE statements for better readability. Added comment in SELECT.sql.
app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/*.sql Reformatted CREATE and UPDATE statements for consistent indentation. Added newline in DELETE.sql.
app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/*.sql Reformatted INSERT and UPDATE statements for indentation. Added newlines in DELETE.sql.
app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/*.sql Reformatted CREATE, UPDATE, and SELECT statements for consistent indentation. Added newlines in DELETE.sql.
app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/*.sql Adjusted indentation in CREATE, UPDATE, and SELECT statements. Added newline in DELETE.sql.
app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/*.sql Reformatted CREATE, UPDATE, and SELECT statements for indentation. Added newline in DELETE.sql.
app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/*.sql Adjusted indentation in SQL schema definitions and index creation statements for better readability.
app/server/pom.xml Added SQL files to the spotless-maven-plugin configuration for formatting.
app/server/application.properties Minor formatting adjustments and comment changes.

Possibly related PRs

Suggested labels

Task, skip-changelog, ok-to-test, Move to Postgres, DB Infrastructure Pod

Suggested reviewers

  • sharat87
  • abhvsn

"In the realm of SQL, we tidy and align,
With comments and spacing, our code will shine.
From CREATE to UPDATE, we format with care,
Making each query a joy to declare!
So here's to the changes, both subtle and bright,
Enhancing our scripts, making them right!" 🎉


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 96ad460 and a0906b3.

📒 Files selected for processing (28)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql (1 hunks)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql (1 hunks)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql (1 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql (1 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql (1 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql (1 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql (1 hunks)
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql (1 hunks)
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql (1 hunks)
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql (1 hunks)
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql (1 hunks)
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql (1 hunks)
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V001__createTables.sql (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V003__createIndexes.sql (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V004__updateIndexes.sql (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V006__updateIndexesForJsonbColumns.sql (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V007__useGINIndexForPermissionGroupIds.sql (1 hunks)
  • app/server/appsmith-server/src/main/resources/application.properties (1 hunks)
  • app/server/pom.xml (1 hunks)
✅ Files skipped from review due to trivial changes (27)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql
  • app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql
  • app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql
  • app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql
  • app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql
  • app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql
  • app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V001__createTables.sql
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V003__createIndexes.sql
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V004__updateIndexes.sql
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V006__updateIndexesForJsonbColumns.sql
  • app/server/appsmith-server/src/main/java/com/appsmith/server/migrations/ce/V007__useGINIndexForPermissionGroupIds.sql
  • app/server/appsmith-server/src/main/resources/application.properties
🔇 Additional comments (1)
app/server/pom.xml (1)

137-137: LGTM! Configuration addition looks correct.

The inclusion of SQL files in Spotless formatting will help maintain consistent checksums across developer machines.

Let's verify the SQL files that will be affected:

✅ Verification successful

Spotless configuration will format SQL files across plugins and migrations

The SQL files that will be affected by the Spotless formatting include:

  • Database plugin templates (CRUD operations) for multiple databases
  • Database migration scripts in the server module

This is the expected scope and aligns with the goal of maintaining consistent checksums across developer machines. The configuration will help standardize both the migration scripts and SQL templates.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: List all SQL files that will be processed by Spotless
# This helps verify the scope of formatting changes

fd -e sql

Length of output: 2758


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Nov 1, 2024

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Nov 1, 2024
@abhvsn
Copy link
Contributor

abhvsn commented Nov 5, 2024

@AnaghHegde is this still valid? Can you please fix the flyway checksum validation?

@github-actions github-actions bot removed the Stale label Nov 5, 2024
@appsmithorg appsmithorg deleted a comment from github-actions bot Nov 8, 2024
@appsmithorg appsmithorg deleted a comment from github-actions bot Nov 9, 2024
@AnaghHegde AnaghHegde merged commit e559073 into pg Nov 11, 2024
@AnaghHegde AnaghHegde deleted the chore/spotless branch November 11, 2024 05:30
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 2, 2024
## Description
Apply spotless to maintain checksum values same across all developers
machine for flyway.

## Automation

/ok-to-test tags=""

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!WARNING]
> Tests have not run on the HEAD
a0906b3 yet
> <hr>Fri, 25 Oct 2024 12:24:39 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**
- Added clearer instructions in SQL templates for entering valid table
names.
  
- **Bug Fixes**
- Improved formatting of SQL statements for better readability across
various templates.

- **Chores**
- Configured the project to include SQL files in the formatting process
using the Spotless plugin.
  
- **Documentation**
- Added comments and adjusted formatting in the `application.properties`
file for clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants