feat(service-auto): phase 2 — comenzi browse, id_sucursala, cache, migrare SQL
Backend: - GET /api/service-auto/comenzi cu paginare server-side, filtre dată/status - ComandaRequest.id_sucursala (Optional) + FirmaItem.id_mama - get_firme() expune id_mama din V_NOM_FIRME - callproc SP_CREEAZA_COMANDA_PROTOTIP cu 7 argumente (+ p_id_sucursala) - Cache TTL in-process: tip_deviz 24h, masini 5min Frontend: - ComenziBrowseView.vue — DataTable lazy + filtre + status badges - ComandaNoua.vue — company store integration, idSucursala computed - service-auto/stores/sharedStores.js (createCompaniesStore factory) - HamburgerMenu: secțiune Service Auto (Comenzi + Comandă Nouă) - router: /service-auto/comenzi SQL: - migrations/ff_2026_04_12_01_AUTO.sql — idempotent (COLUMNEXIST guard + CREATE OR REPLACE SP) - onboarding_roa_web.sql — versioned, parametrizat cu :SCHEMA_NAME - .claude/rules/oracle-migrations.md — convenție ff_YYYY_MM_DD_NN_MODULE.sql Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
71
.claude/rules/oracle-migrations.md
Normal file
71
.claude/rules/oracle-migrations.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
paths: "**/*.sql,docs/service-auto/migrations/**"
|
||||
---
|
||||
|
||||
# Oracle SQL Migration Script Rules
|
||||
|
||||
You are an Oracle SQL migration script writer. Transform raw DDL/DML into idempotent migration scripts following these rules:
|
||||
|
||||
## STRUCTURE
|
||||
- Header comment: `-- brief description` (e.g. `-- adaugare coloana nom_firme.caen_revizie`)
|
||||
- Body (idempotency rules below)
|
||||
- Footer: `exec pack_migrare.UpdateVersiune('<filename_without_.sql>'); commit;`
|
||||
|
||||
## IDEMPOTENCY RULES
|
||||
|
||||
1. **ALTER TABLE ADD COLUMN** → wrap in:
|
||||
```sql
|
||||
BEGIN
|
||||
IF PACK_MIGRARE.COLUMNEXIST('TABLE','COL')=0 THEN
|
||||
EXECUTE IMMEDIATE '...';
|
||||
END IF;
|
||||
END;
|
||||
/
|
||||
```
|
||||
|
||||
2. **CREATE OR REPLACE VIEW/PROCEDURE/FUNCTION** → keep as-is (already idempotent)
|
||||
|
||||
3. **INSERT** → replace with:
|
||||
```sql
|
||||
MERGE INTO table USING DUAL ON (key condition)
|
||||
WHEN NOT MATCHED THEN INSERT (cols) VALUES (vals);
|
||||
```
|
||||
|
||||
4. **UPDATE** → keep as-is
|
||||
|
||||
5. **CREATE TABLE** → wrap in:
|
||||
```sql
|
||||
BEGIN
|
||||
IF PACK_MIGRARE.OBJECTEXIST('TABLE','TABLE')=0 THEN
|
||||
EXECUTE IMMEDIATE '...';
|
||||
END IF;
|
||||
END;
|
||||
/
|
||||
```
|
||||
|
||||
6. **DROP** → wrap in:
|
||||
```sql
|
||||
BEGIN
|
||||
IF PACK_MIGRARE.OBJECTEXIST('OBJ')=1 THEN
|
||||
EXECUTE IMMEDIATE 'DROP...';
|
||||
END IF;
|
||||
END;
|
||||
/
|
||||
```
|
||||
|
||||
7. **COMMENT ON** → keep as plain DDL (not inside EXECUTE IMMEDIATE)
|
||||
|
||||
8. In MERGE/INSERT: omit NULL-valued columns and CLOB columns entirely
|
||||
|
||||
## FILENAME CONVENTION
|
||||
|
||||
```
|
||||
ff_YYYY_MM_DD_NN_<MODULE>.sql
|
||||
```
|
||||
- `YYYY_MM_DD` — data migrării
|
||||
- `NN` — secvență 2 cifre (01, 02...)
|
||||
- `<MODULE>` — modulul căruia îi aparține migrarea (ex: AUTO, FACTURARE, CONTAB)
|
||||
|
||||
## LANGUAGE
|
||||
Comments: write in Romanian.
|
||||
Output: only the SQL script, no explanation.
|
||||
Reference in New Issue
Block a user