Skip to content

Conversation

@davideme
Copy link
Owner

@davideme davideme commented Apr 6, 2025

This PR adds SQL linting capabilities with automated code suggestions using reviewdog.

Changes

  • Added GitHub Actions workflow for SQL linting with reviewdog
  • Added SQLFluff configuration for MySQL and PostgreSQL
  • Added SQL linting script for local development
  • Updated docker-compose with SQL linting service

Features

  • Automatic SQL linting on PRs
  • Code suggestions using reviewdog
  • Support for both MySQL and PostgreSQL dialects
  • Local linting capability via Docker

How to Use

  1. In Pull Requests:

    • The workflow automatically runs on SQL file changes
    • Reviewdog will suggest fixes as PR comments
  2. Locally:

    ./scripts/lint-sql.sh

Closes #1

@davideme davideme requested a review from Copilot April 6, 2025 15:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 14 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • .sqlfluff: Language not supported
  • database/sql/mysql/schema.sql: Language not supported
  • database/sql/postgresql/schema.sql: Language not supported
  • scripts/lint-sql.sh: Language not supported
  • test-databases.sh: Language not supported
Comments suppressed due to low confidence (2)

database/mongodb/init.js:43

  • The usage of UUID() in the insert document may cause runtime errors if UUID() is not defined in your MongoDB environment. Consider using a well-supported UUID generation method or the native ObjectId to ensure consistent behavior.
  _id: UUID().toString(),

.github/workflows/database-tests.yml:47

  • [nitpick] The use of double quotes in the --format parameter may lead to shell parsing issues. Consider using single quotes around the format string (e.g., '--format "{{.ExitCode}}"') to avoid potential interpolation problems.
EXIT_CODE=$(docker compose ps -a --format "{{.ExitCode}}" test)

@davideme davideme requested a review from Copilot April 6, 2025 17:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 14 changed files in this pull request and generated no comments.

Files not reviewed (5)
  • .sqlfluff: Language not supported
  • database/sql/mysql/schema.sql: Language not supported
  • database/sql/postgresql/schema.sql: Language not supported
  • scripts/lint-sql.sh: Language not supported
  • test-databases.sh: Language not supported
Comments suppressed due to low confidence (1)

database/mongodb/init.js:43

  • Ensure that 'new UUID()' is supported in the MongoDB shell environment; if not, consider using the standard UUID() function or another reliable UUID generation method.
  _id: new UUID().toString(),

@davideme davideme merged commit 9a79cbc into main Apr 6, 2025
2 checks passed
@davideme davideme deleted the database-schema-definition branch April 7, 2025 17:55
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.

Database Schema Definition

2 participants