From dea3eb8cc2b1ef1c2bdb0f39465f4f2302faa3c8 Mon Sep 17 00:00:00 2001 From: shockrah Date: Fri, 8 May 2026 00:12:34 -0700 Subject: [PATCH] Updating sql to be more generic and biznizzy --- .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ collector/db/init.sql | 8 ++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3615fef..a563246 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,32 @@ repos: rev: 3.0.7 # Use the latest stable version hooks: - id: sqlfluff-lint + name: Postgres Linting args: [--dialect, postgres] # Only run on files in the db/ directory ending in .sql files: ^collector/db/.*\.sql$ + # Dockerfile linting + - repo: https://github.com/hadolint/hadolint + rev: v2.12.0 + hooks: + - id: hadolint + name: Dockerfile Linter + files: ^collector/(db|api)/Dockerfile$ + + # Linting Docker Compose stuff + - repo: local + hooks: + - id: docker-compose-check + name: Docker Compose Config Check + entry: docker compose -f collector/docker-compose.yaml config --quiet + language: system + files: ^collector/docker-compose\.yaml$ + pass_filenames: false + + # 3. General YAML linting for Docker Compose + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + types: [yaml] + files: ^collector/docker-compose\.yaml$ diff --git a/collector/db/init.sql b/collector/db/init.sql index e5d450b..d8a35f8 100644 --- a/collector/db/init.sql +++ b/collector/db/init.sql @@ -2,10 +2,10 @@ CREATE DATABASE collector; \c collector --- Modeling the stores that we track overall +-- Modeling the businesses that we track overall CREATE TABLE businesses ( - store_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), - store_name VARCHAR(255) NOT NULL + business_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + business_name VARCHAR(255) NOT NULL ); -- Modeling the products @@ -14,7 +14,7 @@ CREATE TABLE products ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), -- Store-specific Identifiers - business_id UUID REFERENCES businesses (store_id) NOT NULL, + business_id UUID REFERENCES businesses (business_id) NOT NULL, -- Product Details product_name VARCHAR(255) NOT NULL,