From c2bf6c830e4972d8ffba4cd345bae11aadebab5e Mon Sep 17 00:00:00 2001 From: Anagh Hegde Date: Sat, 9 Nov 2024 11:21:30 +0530 Subject: [PATCH] chore: add spotless for sql files for postgres (#37016) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Add spotless check for SQL files. ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 5614181e15e5cfa768f43fb73d23b559ddaba782 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Mon, 28 Oct 2024 11:13:16 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Added user guidance in SQL templates to prompt users for valid table names. - **Bug Fixes** - Improved formatting of SQL statements for better readability across various plugins. - **Chores** - Updated configuration to include SQL files for formatting by the Spotless Maven plugin. --- .../src/main/resources/templates/CREATE.sql | 12 ++++++------ .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 4 ++-- .../src/main/resources/templates/CREATE.sql | 12 ++++++------ .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 4 ++-- .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/INSERT.sql | 12 ++++++------ .../src/main/resources/templates/UPDATE.sql | 2 +- .../src/main/resources/templates/CREATE.sql | 12 ++++++------ .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 4 ++-- .../src/main/resources/templates/CREATE.sql | 12 ++++++------ .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 4 ++-- .../src/main/resources/templates/CREATE.sql | 12 ++++++------ .../src/main/resources/templates/DELETE.sql | 2 +- .../src/main/resources/templates/SELECT.sql | 2 +- .../src/main/resources/templates/UPDATE.sql | 4 ++-- app/server/pom.xml | 1 + 22 files changed, 57 insertions(+), 56 deletions(-) diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql index cfbb938377..8588138670 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/CREATE.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - {{ nameInput.text }}, - {{ genderDropdown.selectedOptionValue }}, - {{ emailInput.text }} - ); + ( + {{ nameInput.text }}, + {{ genderDropdown.selectedOptionValue }}, + {{ emailInput.text }} + ); diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql index f4d3905f05..57ce558bd2 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/SELECT.sql @@ -1,3 +1,3 @@ SELECT TOP 10 * FROM <>; --- Please enter a valid table name and hit RUN \ No newline at end of file +-- Please enter a valid table name and hit RUN diff --git a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql index de4915e6fd..5ecd96ba4d 100644 --- a/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/mssqlPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users - SET status = 'APPROVED' - WHERE id = {{ usersTable.selectedRow.id }}; + SET status = 'APPROVED' + WHERE id = {{ usersTable.selectedRow.id }}; diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql index b5253c2bf8..8588138670 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/CREATE.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - {{ nameInput.text }}, - {{ genderDropdown.selectedOptionValue }}, - {{ emailInput.text }} - ); \ No newline at end of file + ( + {{ nameInput.text }}, + {{ genderDropdown.selectedOptionValue }}, + {{ emailInput.text }} + ); diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql index e7014662d5..459aa04c54 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = -1; \ No newline at end of file +DELETE FROM users WHERE id = -1; diff --git a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql index facf9fc3f9..5ecd96ba4d 100644 --- a/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/mysqlPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users - SET status = 'APPROVED' - WHERE id = {{ usersTable.selectedRow.id }}; \ No newline at end of file + SET status = 'APPROVED' + WHERE id = {{ usersTable.selectedRow.id }}; diff --git a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql index c5000f4ee8..a763c222ab 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = {{idInput.text}} \ No newline at end of file +DELETE FROM users WHERE id = {{idInput.text}} diff --git a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql index f59768c5c5..e4a64159fe 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/INSERT.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - {{ nameInput.text }}, - {{ genderDropdown.selectedOptionValue }}, - {{ emailInput.text }} - ) \ No newline at end of file + ( + {{ nameInput.text }}, + {{ genderDropdown.selectedOptionValue }}, + {{ emailInput.text }} + ) diff --git a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql index 1e8246500e..2b9cb5d2a0 100755 --- a/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/oraclePlugin/src/main/resources/templates/UPDATE.sql @@ -1 +1 @@ -UPDATE users SET status = 'APPROVED' WHERE id = {{ usersTable.selectedRow.id }} \ No newline at end of file +UPDATE users SET status = 'APPROVED' WHERE id = {{ usersTable.selectedRow.id }} diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql index b5253c2bf8..8588138670 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/CREATE.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - {{ nameInput.text }}, - {{ genderDropdown.selectedOptionValue }}, - {{ emailInput.text }} - ); \ No newline at end of file + ( + {{ nameInput.text }}, + {{ genderDropdown.selectedOptionValue }}, + {{ emailInput.text }} + ); diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql index e7014662d5..459aa04c54 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = -1; \ No newline at end of file +DELETE FROM users WHERE id = -1; diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql index 1c25fafff4..036ff8b229 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/SELECT.sql @@ -1,3 +1,3 @@ SELECT * FROM <> LIMIT 10; --- Please enter a valid table name and hit RUN \ No newline at end of file +-- Please enter a valid table name and hit RUN diff --git a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql index de4915e6fd..5ecd96ba4d 100644 --- a/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/postgresPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users - SET status = 'APPROVED' - WHERE id = {{ usersTable.selectedRow.id }}; + SET status = 'APPROVED' + WHERE id = {{ usersTable.selectedRow.id }}; diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql index b5253c2bf8..8588138670 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/CREATE.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - {{ nameInput.text }}, - {{ genderDropdown.selectedOptionValue }}, - {{ emailInput.text }} - ); \ No newline at end of file + ( + {{ nameInput.text }}, + {{ genderDropdown.selectedOptionValue }}, + {{ emailInput.text }} + ); diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql index e7014662d5..459aa04c54 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = -1; \ No newline at end of file +DELETE FROM users WHERE id = -1; diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql index 1c25fafff4..036ff8b229 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/SELECT.sql @@ -1,3 +1,3 @@ SELECT * FROM <> LIMIT 10; --- Please enter a valid table name and hit RUN \ No newline at end of file +-- Please enter a valid table name and hit RUN diff --git a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql index facf9fc3f9..5ecd96ba4d 100644 --- a/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/redshiftPlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users - SET status = 'APPROVED' - WHERE id = {{ usersTable.selectedRow.id }}; \ No newline at end of file + SET status = 'APPROVED' + WHERE id = {{ usersTable.selectedRow.id }}; diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql index 3166e4d345..85b7e1cce8 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/CREATE.sql @@ -1,8 +1,8 @@ INSERT INTO users - (name, gender, email) + (name, gender, email) VALUES - ( - '{{ nameInput.text }}', - '{{ genderDropdown.selectedOptionValue }}', - '{{ emailInput.text }}' - ); \ No newline at end of file + ( + '{{ nameInput.text }}', + '{{ genderDropdown.selectedOptionValue }}', + '{{ emailInput.text }}' + ); diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql index e7014662d5..459aa04c54 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/DELETE.sql @@ -1 +1 @@ -DELETE FROM users WHERE id = -1; \ No newline at end of file +DELETE FROM users WHERE id = -1; diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql index 1c25fafff4..036ff8b229 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/SELECT.sql @@ -1,3 +1,3 @@ SELECT * FROM <> LIMIT 10; --- Please enter a valid table name and hit RUN \ No newline at end of file +-- Please enter a valid table name and hit RUN diff --git a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql index 966633a705..0a7e95bb77 100644 --- a/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql +++ b/app/server/appsmith-plugins/snowflakePlugin/src/main/resources/templates/UPDATE.sql @@ -1,3 +1,3 @@ UPDATE users - SET status = 'APPROVED' - WHERE id = '{{ usersTable.selectedRow.id }}'; \ No newline at end of file + SET status = 'APPROVED' + WHERE id = '{{ usersTable.selectedRow.id }}'; diff --git a/app/server/pom.xml b/app/server/pom.xml index 1bd3cba3ad..814ba68518 100644 --- a/app/server/pom.xml +++ b/app/server/pom.xml @@ -134,6 +134,7 @@ *.md .gitignore + **/*.sql