wk
This commit is contained in:
@@ -10,6 +10,122 @@ This guide provides step-by-step instructions for developers on how to properly
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## MANDATORY STANDARDS (NEVER SKIP!)
|
||||||
|
|
||||||
|
### 🔴 Critical: Author Field
|
||||||
|
|
||||||
|
**ALL scripts MUST have:**
|
||||||
|
```sql
|
||||||
|
-- Author: Grzegorz Michalski
|
||||||
|
```
|
||||||
|
|
||||||
|
**❌ WRONG:**
|
||||||
|
```sql
|
||||||
|
-- Author: System
|
||||||
|
-- Author: Developer
|
||||||
|
-- Author: [your name here]
|
||||||
|
```
|
||||||
|
|
||||||
|
**✅ CORRECT:**
|
||||||
|
```sql
|
||||||
|
-- Author: Grzegorz Michalski
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📅 Date Format Standard
|
||||||
|
|
||||||
|
**ISO 8601 format only:**
|
||||||
|
```sql
|
||||||
|
-- Date: 2026-02-03 (YYYY-MM-DD)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📝 Script Header Template
|
||||||
|
|
||||||
|
**Copy-paste this template for ALL scripts:**
|
||||||
|
```sql
|
||||||
|
-- =====================================================================
|
||||||
|
-- Script: XX_MARS_XXX_description.sql
|
||||||
|
-- MARS Issue: MARS-XXX
|
||||||
|
-- Purpose: Brief description of what this script does
|
||||||
|
-- Author: Grzegorz Michalski
|
||||||
|
-- Date: YYYY-MM-DD
|
||||||
|
-- =====================================================================
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔐 Database User Requirements
|
||||||
|
|
||||||
|
**Execute installations as ADMIN:**
|
||||||
|
```powershell
|
||||||
|
# ✅ CORRECT
|
||||||
|
Get-Content "install_marsXXX.sql" | sql "ADMIN/password@service"
|
||||||
|
|
||||||
|
# ❌ WRONG
|
||||||
|
Get-Content "install_marsXXX.sql" | sql "CT_MRDS/password@service"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔍 Data Dictionary Views
|
||||||
|
|
||||||
|
**Use ALL_* views when installing as ADMIN:**
|
||||||
|
```sql
|
||||||
|
-- ✅ CORRECT (ADMIN user)
|
||||||
|
SELECT * FROM ALL_ERRORS WHERE OWNER = 'CT_MRDS' AND NAME = 'PACKAGE_NAME';
|
||||||
|
|
||||||
|
-- ❌ WRONG (shows ADMIN schema, not CT_MRDS)
|
||||||
|
SELECT * FROM USER_ERRORS WHERE NAME = 'PACKAGE_NAME';
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📂 Log Directory Management
|
||||||
|
|
||||||
|
**MANDATORY in all master scripts:**
|
||||||
|
```sql
|
||||||
|
-- Create log/ directory before SPOOL (prevents failures)
|
||||||
|
host mkdir log 2>nul
|
||||||
|
|
||||||
|
-- Then configure dynamic SPOOL filename
|
||||||
|
var filename VARCHAR2(100)
|
||||||
|
BEGIN
|
||||||
|
:filename := 'log/INSTALL_MARS_XXX_' || SYS_CONTEXT('USERENV', 'CON_NAME') || '_' || TO_CHAR(SYSDATE,'YYYYMMDD_HH24MISS') || '.log';
|
||||||
|
END;
|
||||||
|
/
|
||||||
|
```
|
||||||
|
|
||||||
|
### ✋ User Confirmation
|
||||||
|
|
||||||
|
**MANDATORY ACCEPT validation in master scripts:**
|
||||||
|
```sql
|
||||||
|
ACCEPT continue CHAR PROMPT 'Type YES to continue with installation, or Ctrl+C to abort: '
|
||||||
|
WHENEVER SQLERROR EXIT SQL.SQLCODE
|
||||||
|
BEGIN
|
||||||
|
IF '&continue' IS NULL OR TRIM('&continue') IS NULL OR UPPER(TRIM('&continue')) != 'YES' THEN
|
||||||
|
RAISE_APPLICATION_ERROR(-20001, 'Installation aborted by user');
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
/
|
||||||
|
WHENEVER SQLERROR CONTINUE
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚪 Clean Exit
|
||||||
|
|
||||||
|
**End all master scripts with:**
|
||||||
|
```sql
|
||||||
|
spool off
|
||||||
|
quit; -- ← MANDATORY for clean SQLcl/SQL*Plus exit
|
||||||
|
```
|
||||||
|
|
||||||
|
### 📋 Quick Compliance Checklist
|
||||||
|
|
||||||
|
Before committing any script, verify:
|
||||||
|
- [ ] `Author: Grzegorz Michalski` in header
|
||||||
|
- [ ] Date in ISO 8601 format (YYYY-MM-DD)
|
||||||
|
- [ ] Master scripts use `host mkdir log 2>nul`
|
||||||
|
- [ ] Master scripts require ACCEPT validation
|
||||||
|
- [ ] Master scripts end with `quit;`
|
||||||
|
- [ ] Verification queries use ALL_* views with OWNER filter
|
||||||
|
- [ ] Installation instructions specify ADMIN user
|
||||||
|
|
||||||
|
**💡 Remember:** These standards prevent common mistakes and ensure consistency across all MARS packages!
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
1. [Before You Start](#before-you-start)
|
1. [Before You Start](#before-you-start)
|
||||||
|
|||||||
Reference in New Issue
Block a user