Updating sql to be more generic and biznizzy

This commit is contained in:
2026-05-08 00:12:34 -07:00
parent 8a8eb88ced
commit dea3eb8cc2
2 changed files with 30 additions and 4 deletions

View File

@@ -3,6 +3,32 @@ repos:
rev: 3.0.7 # Use the latest stable version rev: 3.0.7 # Use the latest stable version
hooks: hooks:
- id: sqlfluff-lint - id: sqlfluff-lint
name: Postgres Linting
args: [--dialect, postgres] args: [--dialect, postgres]
# Only run on files in the db/ directory ending in .sql # Only run on files in the db/ directory ending in .sql
files: ^collector/db/.*\.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$

View File

@@ -2,10 +2,10 @@
CREATE DATABASE collector; CREATE DATABASE collector;
\c collector \c collector
-- Modeling the stores that we track overall -- Modeling the businesses that we track overall
CREATE TABLE businesses ( CREATE TABLE businesses (
store_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), business_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
store_name VARCHAR(255) NOT NULL business_name VARCHAR(255) NOT NULL
); );
-- Modeling the products -- Modeling the products
@@ -14,7 +14,7 @@ CREATE TABLE products (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- Store-specific Identifiers -- Store-specific Identifiers
business_id UUID REFERENCES businesses (store_id) NOT NULL, business_id UUID REFERENCES businesses (business_id) NOT NULL,
-- Product Details -- Product Details
product_name VARCHAR(255) NOT NULL, product_name VARCHAR(255) NOT NULL,