Browse Source

fix: added SQL migration for warehouse units and updated coding rules

unknown 20 hours ago
parent
commit
35578b6a21
2 changed files with 12 additions and 1 deletions
  1. 6 1
      .gemini_rules.md
  2. 6 0
      backend/migrations/002_warehouse_units.sql

+ 6 - 1
.gemini_rules.md

@@ -7,13 +7,18 @@ Before any `git push` or claiming a task is "ready", the AI MUST:
 3. **Production Build**: Run `npm run build` or `vite build` to ensure the project compiles correctly and there are no circular dependencies or missing imports in the production bundle.
 4. **Local Verification**: If possible, verify the UI changes via screenshots or browser tools.
 
+5. Use cmd /c for Windows commands
+
 ## Search and Investigation
 - **ALWAYS** use `python tools/search.py "query"` instead of `grep` or `ripgrep` for searching code.
 - Example: `python tools/search.py "t(\"admin.tabs\"" --include .vue .ts`
 - This ensures consistent results across different operating systems and avoids shell escaping issues.
 
+## Backend and Database
+- **ALWAYS** provide database migrations as `.sql` files in `backend/migrations/` (naming: `00X_name.sql`).
+- Avoid using one-off `.py` scripts for production migrations as they are not tracked by the automatic deployment script.
+
 ## Localization Rules
-- **NEVER** edit `en.admin.json`, `ru.json`, etc., directly.
 - **NEVER** edit `translations.admin.json` or `translations.user.json` directly.
 - **ALWAYS** edit fragments in `src/locales/master_admin/` or `src/locales/master_user/`.
 - After editing fragments, run the `split` command to propagate changes.

+ 6 - 0
backend/migrations/002_warehouse_units.sql

@@ -0,0 +1,6 @@
+-- Migration: 002_warehouse_units
+-- Created: 2026-04-19
+-- Description: Add unit_mass and units_count to warehouse_stock
+
+ALTER TABLE warehouse_stock ADD COLUMN unit_mass decimal(10,3) DEFAULT 1.000;
+ALTER TABLE warehouse_stock ADD COLUMN units_count int DEFAULT 0;