- Зачем: - в статье и скриптах обнаружены фактические ошибки и несостыковки - Что: - README: f.order_date -> d.date_actual в примере витрины (колонки order_date нет в fact_sales) - README: «календарь на 10 лет» -> «5 лет» (соответствует генерации 2023-2027 в скрипте) - 09_solution: bounds CTE теперь использует CURRENT_DATE для открытых интервалов (valid_to IS NULL) - 09_solution: комментарий про дубли в STG при повторном запуске блока 3 - 05_ddl_dm: выравнивание total_line_items - AGENTS.md: обновлён диапазон скриптов 01-09 - Проверка: - визуальная проверка diff Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
2.3 KiB
Markdown
38 lines
2.3 KiB
Markdown
# Repository Guidelines
|
||
|
||
## Project Structure & Module Organization
|
||
- Root `README.md` describes the learning roadmap (RU).
|
||
- `dwh-modeling/` contains the article and demo DWH model; SQL lives in `dwh-modeling/sql` as ordered scripts `01_...sql`–`09_...sql` (07–09 are homework DDL, template and solution).
|
||
- `postgres-bookings/` is a Dockerized PostgreSQL + demo “bookings” DB; start it first, then apply DWH scripts against the `demo` database.
|
||
|
||
## Build, Test, and Development Commands
|
||
- Start demo Postgres:
|
||
`cd postgres-bookings && bash download_db.sh && docker compose up -d`
|
||
- Open `psql` inside the container:
|
||
`cd postgres-bookings && ./psql_sh`
|
||
- Apply DWH schema from the repo root (after Postgres is up):
|
||
`psql -h 127.0.0.1 -p 5432 -U postgres -d demo -f dwh-modeling/sql/01_ddl_stg-dds.sql`
|
||
- Stop and reset the cluster when needed:
|
||
`cd postgres-bookings && docker compose down -v`
|
||
|
||
## Coding Style & Naming Conventions
|
||
- SQL: PostgreSQL dialect, uppercase keywords, `snake_case` identifiers, 4-space indentation, and concise comments (`-- ...`).
|
||
- SQL files: keep numeric prefixes (`01_`, `02_`, …) to reflect execution order and use descriptive suffixes like `ddl_*` / `dml_*`.
|
||
- Shell: target `bash`, prefer simple, POSIX-friendly constructs; mirror the style of existing scripts in `postgres-bookings/`.
|
||
|
||
## Testing Guidelines
|
||
- There is no dedicated test framework; treat SQL scripts as executable documentation.
|
||
- For `dwh-modeling/sql`, run scripts sequentially and rerun `04_validation.sql` after changes to ensure the demo model still loads and basic checks pass.
|
||
- For `postgres-bookings`, after modifications run `docker compose up -d && ./psql_sh` and verify simple queries such as `SELECT COUNT(*) FROM bookings.flights;`.
|
||
|
||
## Commit & Pull Request Guidelines
|
||
|
||
**Required:** Read [COMMIT_RULES.md](COMMIT_RULES.md) before making commits.
|
||
|
||
Pull requests should focus on one topic, include a brief context, list of changes, and manual steps to reproduce or validate (commands you ran, expected results).
|
||
|
||
## Security & Configuration Tips
|
||
- Do not commit personal `.env` files or credentials; use local overrides only.
|
||
- Demo credentials and ports in `postgres-bookings` are for local training only—never reuse them in shared or production environments.
|
||
|