-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from PhilanthropyDataCommons/sqlfluff
Lint SQL with SQLFluff
- Loading branch information
Showing
76 changed files
with
257 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[sqlfluff] | ||
dialect = postgres | ||
templater = placeholder | ||
exclude_rules = | ||
layout.indent, | ||
# allow use of keywords as identifiers when unambiguous | ||
references.keywords, | ||
|
||
[sqlfluff:indentation] | ||
indent_unit = space | ||
tab_space_size = 2 | ||
|
||
[sqlfluff:rules:convention.terminator] | ||
multiline_newline = False | ||
require_final_semicolon = True | ||
|
||
[sqlfluff:templater:placeholder] | ||
param_style = colon | ||
|
||
# placeholder values | ||
limit = 20 | ||
offset = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
dist/ | ||
node_modules/ | ||
|
||
# Migrations are immutable, so already-committed migrations cannot be corrected. | ||
# https://github.com/zakpatterson/postgres-schema-migrations/blob/75f22a65d3a8ddd16356e74538316fec2ca0202e/README.md#hash-checks-for-previous-migrations | ||
src/database/migrations/0001-create-canonical_fields.sql | ||
src/database/migrations/0002-create-opportunities.sql | ||
src/database/migrations/0003-create-applicants.sql | ||
src/database/migrations/0004-create-application_forms.sql | ||
src/database/migrations/0005-create-application_form_fields.sql | ||
src/database/migrations/0006-create-proposals.sql | ||
src/database/migrations/0007-create-proposal_versions.sql | ||
src/database/migrations/0008-create-proposal_field_values.sql | ||
src/database/migrations/0009-alter-proposal_field_values-position.sql | ||
src/database/migrations/0010-alter-proposal_field_values-value_search.sql | ||
src/database/migrations/0011-rename-canonical_fields.sql | ||
src/database/migrations/0012-create-platform_provider_responses.sql | ||
src/database/migrations/0013-create-bulk_uploads.sql | ||
src/database/migrations/0014-alter-base_fields-description.sql | ||
src/database/migrations/0015-alter-bulk_uploads-source_key.sql | ||
src/database/migrations/0016-alter-bulk_uploads-file_size.sql | ||
src/database/migrations/0017-create-organizations.sql | ||
src/database/migrations/0018-remove-applicants.sql | ||
src/database/migrations/0019-create-organizations_proposals.sql | ||
src/database/migrations/0020-alter-base_fields.sql | ||
src/database/migrations/0021-alter-proposal_field_values.sql | ||
src/database/migrations/0022-create-users.sql | ||
src/database/migrations/0023-insert-system-user.sql | ||
src/database/migrations/0024-alter-bulk_uploads.sql | ||
src/database/migrations/0025-alter-proposals.sql | ||
src/database/migrations/0026-alter-base_fields-add-field_scope.sql | ||
src/database/migrations/0027-alter-organizations-rename-ein.sql | ||
src/database/migrations/0028-alter-field_type-enum.sql | ||
src/database/migrations/0029-create-base_field_localizations.sql | ||
src/database/migrations/0030-create-funders.sql | ||
src/database/migrations/0031-create-data_providers.sql | ||
src/database/migrations/0032-create-sources.sql | ||
src/database/migrations/0033-alter-proposal_versions-add-sourceId.sql | ||
src/database/migrations/0034-alter-bulk_uploads-add-source_id.sql | ||
src/database/migrations/0035-alter-proposal_versions-add-created_by.sql | ||
src/database/migrations/0036-create-function-drop_function.sql | ||
src/database/migrations/0037-alter-users-change-authentication_id-to-keycloak_user_id.sql | ||
src/database/migrations/0038-alter-users-use-keycloak_user_id-as-primary-key.sql | ||
src/database/migrations/0039-rename-organizations-to-changemakers.sql | ||
src/database/migrations/0040-create-permission-tables.sql | ||
src/database/migrations/0041-rename-bulk_uploads-to-bulk_upload_tasks.sql | ||
|
||
# This file is very large, and is intended to be removed soon. | ||
src/database/seeds/0001-insert-base_fields.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sqlfluff==3.2.5 |
6 changes: 4 additions & 2 deletions
6
src/database/initialization/application_form_field_to_json.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/database/initialization/base_field_localization_to_json.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/database/initialization/user_changemaker_permission_to_json.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/database/initialization/user_data_provider_permission_to_json.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/database/initialization/user_funder_permission_to_json.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
SELECT application_form_field_to_json(application_form_fields) AS "object" | ||
SELECT application_form_field_to_json(application_form_fields) AS object | ||
FROM application_form_fields | ||
WHERE id = :id; |
6 changes: 3 additions & 3 deletions
6
src/database/queries/applicationFormFields/selectWithPagination.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
SELECT application_form_field_to_json(application_form_fields) AS "object" | ||
SELECT application_form_field_to_json(application_form_fields) AS object | ||
FROM application_form_fields | ||
WHERE | ||
CASE | ||
WHEN :applicationFormId::integer IS NULL THEN | ||
true | ||
TRUE | ||
ELSE | ||
application_form_id = :applicationFormId | ||
END | ||
ORDER BY position, id | ||
LIMIT :limit | ||
OFFSET :offset | ||
OFFSET :offset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
SELECT application_form_to_json(application_forms) AS "object" | ||
SELECT application_form_to_json(application_forms) AS object | ||
FROM application_forms | ||
WHERE id = :id; | ||
|
4 changes: 2 additions & 2 deletions
4
src/database/queries/applicationForms/selectWithPagination.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
SELECT application_form_to_json(application_forms) AS "object" | ||
SELECT application_form_to_json(application_forms) AS object | ||
FROM application_forms | ||
ORDER BY id | ||
LIMIT :limit | ||
OFFSET :offset | ||
OFFSET :offset; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
SELECT base_field_localization_to_json(base_field_localizations.*) as "object" | ||
SELECT base_field_localization_to_json(base_field_localizations.*) AS object | ||
FROM base_field_localizations; |
6 changes: 3 additions & 3 deletions
6
src/database/queries/baseFieldLocalizations/selectWithPagination.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
SELECT base_field_localization_to_json(base_field_localizations) AS "object" | ||
SELECT base_field_localization_to_json(base_field_localizations) AS object | ||
FROM base_field_localizations | ||
WHERE | ||
CASE | ||
WHEN :baseFieldId::integer IS NULL THEN | ||
true | ||
TRUE | ||
ELSE | ||
base_field_id = :baseFieldId | ||
END | ||
ORDER BY created_at | ||
LIMIT :limit | ||
OFFSET :offset | ||
OFFSET :offset; |
Oops, something went wrong.