Skip to main content

Data Retention & Compliance

Overview

This document defines the data retention policies, backup procedures, privacy requirements, and compliance obligations for the Lofty Golden Oil ERP system. These policies are designed to meet Nigerian business compliance requirements including tax law, corporate regulations, and the Nigerian Data Protection Regulation (NDPR) 2019.

Applicable Regulations:

  • Nigerian Companies and Allied Matters Act (CAMA)
  • Nigerian Tax Laws (Companies Income Tax Act, Value Added Tax Act)
  • Nigerian Data Protection Regulation (NDPR) 2019
  • Financial Reporting Council of Nigeria (FRCN) requirements

Data Retention Policy

Financial Records

Scope: Sales transactions, invoices, payments, expenses, general ledger entries, journal entries, payment vouchers, trial balance reports, profit and loss statements, balance sheets.

Data TypeMinimum RetentionJustification
Sales records7 yearsNigerian Companies Income Tax Act
Invoices (AR)7 yearsTax audit trail requirements
Payments received7 yearsFinancial reconciliation records
Expenses7 yearsTax deduction substantiation
General Ledger entries7 yearsStatutory financial records
Journal entries7 yearsAudit trail for financial statements
Payment vouchers7 yearsDisbursement authorization records
Tax-related records7 yearsFIRS audit requirements

Implementation:

  • Financial records in MySQL are never deleted from the database.
  • A scheduled job can archive records older than 7 years to cold storage (recommended).
  • Database backups preserve all historical data.

Audit Logs

Scope: All entries in the audit_log table including user actions, CRUD operations, login events, approvals, rejections, and IP addresses.

Data TypeRetention PeriodJustification
System audit logsIndefiniteNever delete — required for compliance, forensics, and dispute resolution

Implementation:

  • The audit_log table has no DELETE endpoint.
  • No application code removes audit log entries.
  • Backups preserve all audit history.
  • If the table grows beyond reasonable size, archive old entries to cold storage — never delete.

User Records

Scope: Employee and system user accounts including name, email, role, status, and activity history.

Data TypeRetention PeriodJustification
Active user profilesDuration of employment + 7 yearsEmployment records retention
User role historyDuration of employment + 7 yearsAccess control audit trail
User login history2 yearsSecurity monitoring
Inactive accounts7 years after deactivationEmployment record compliance

Implementation:

  • User accounts are deactivated (status set to inactive), never deleted, when employees leave.
  • The users table retains all historical records.
  • Personal data of former employees is retained solely for compliance purposes.

Inventory Records

Scope: Inventory items, stock levels, stock adjustments, and historical cost data.

Data TypeRetention PeriodJustification
Inventory master data5 years after last transactionProduct lifecycle tracking
Stock levels (point-in-time)5 yearsOperational history
Inventory adjustments5 yearsLoss prevention and audit
SKU history5 yearsProduct identification continuity

Implementation:

  • Inventory items are marked as Inactive rather than deleted when no longer stocked.
  • All stock transactions (purchases, sales, adjustments) are permanently recorded.
  • Historical cost data supports financial reporting and tax compliance.

Customer and Supplier Records

Scope: Customer and supplier profiles, contact information, and transaction history.

Data TypeRetention PeriodJustification
Customer profiles7 years after last transactionBusiness relationship records
Customer credit history7 yearsCredit risk assessment history
Supplier profiles7 years after last transactionProcurement audit trail
Customer/supplier contact data7 yearsCommunication records for disputes

Implementation:

  • Customer and supplier records are marked Inactive rather than deleted.
  • Transaction history (sales, purchases, invoices, payments) is permanently retained.
  • Personal contact data (names, phone numbers, emails) is retained only as long as legally required.

Production Records

Scope: Production runs, batch records, input/output volumes, yield calculations, and cost data.

Data TypeRetention PeriodJustification
Production run records5 yearsManufacturing quality and cost tracking
Batch information5 yearsTraceability for product quality
Yield calculations5 yearsOperational efficiency analysis
Cost per litre data5 yearsPricing and profitability analysis

Implementation:

  • Production records are permanently retained in the database.
  • No deletion mechanism exists for production runs.
  • Data supports historical trend analysis and regulatory compliance.

Requisition Records

Scope: All requisition records including the complete approval workflow with notes and timestamps.

Data TypeRetention PeriodJustification
Requisition records7 yearsExpenditure authorization documentation
Approval workflow history7 yearsInternal control compliance
Supervisor/manager notes7 yearsDecision-making audit trail
Rejection records7 yearsGovernance and accountability

Implementation:

  • Requisition records are never deleted.
  • The full approval chain (who approved, when, with what notes) is permanently retained.
  • This data supports internal and external audit of expenditure controls.

Data Backup Policy

Backup Schedule

Backup TypeFrequencyRetentionDescription
Full database backupDaily at 02:00 WAT30 daysComplete dump of lgo_erp_prod
Staging database backupWeekly (Sunday 03:00 WAT)30 daysComplete dump of lgo_erp_staging
Monthly archive1st of each month12 monthsFull backup archived separately
Pre-deployment backupBefore each deploymentUntil next backupSafety net for CI/CD changes

Backup Locations

LocationTypePurpose
VPS local (/var/backups/lgo-erp/)PrimaryFast restoration
Offsite (recommended)SecondaryDisaster recovery

Recommended Offsite Options:

  • Oracle Cloud Object Storage (same region, low latency)
  • AWS S3 with lifecycle policies
  • Encrypted backup to a secondary VPS

Backup Commands

# Daily backup of production database
mysqldump -u lgo -p"$DB_PASSWORD" lgo_erp_prod | gzip > /var/backups/lgo-erp/prod_$(date +%Y%m%d).sql.gz

# Cleanup: remove backups older than 30 days
find /var/backups/lgo-erp/ -name "prod_*.sql.gz" -mtime +30 -delete

# Monthly archive (1st of month, keep 12 months)
cp /var/backups/lgo-erp/prod_$(date +%Y%m%d).sql.gz /var/backups/lgo-erp/monthly/
find /var/backups/lgo-erp/monthly/ -name "prod_*.sql.gz" -mtime +365 -delete

Backup Verification

CheckFrequencyMethod
Backup file existsDailyAutomated script
Backup file is non-emptyDailyAutomated script
Backup file integrity (gzip test)DailyAutomated script
Restoration testMonthlyManual restore to staging VPS
Full disaster recovery drillQuarterlyManual restore to new VPS

Restoration Procedure

# 1. Stop the application
pm2 stop lgo-prod

# 2. Create a pre-restoration backup
mysqldump -u lgo -p lgo_erp_prod > /var/backups/lgo-erp/pre_restore.sql

# 3. Restore the database
mysql -u lgo -p lgo_erp_prod < /var/backups/lgo-erp/prod_YYYYMMDD.sql

# 4. Verify data integrity
mysql -u lgo -p -e "SELECT COUNT(*) FROM lgo_erp_prod.sales;"

# 5. Restart the application
pm2 start lgo-prod

Data Deletion Procedures

Soft Delete (Preferred)

Business records should use soft delete — setting a status field to indicate deletion without removing the record:

EntitySoft Delete Method
UsersSet status to inactive
CustomersSet status to Inactive
SuppliersSet status to Inactive
Inventory itemsSet status to Inactive
SalesSet status to cancelled
ExpensesSet status to rejected
RequisitionsSet status to rejected

Hard Delete (Restricted)

Hard delete (permanent record removal) should only be used for:

  • Test data created during development
  • Duplicate records created in error (with admin approval)
  • Data explicitly requested for deletion under NDPR (subject to legal review)

Hard Delete Rules:

  • Requires admin approval
  • Must be logged in the audit log before deletion
  • Must not violate foreign key constraints (RESTRICT on most FK relationships)
  • Financial records must never be hard-deleted

Cascading Deletes

Foreign key cascading is configured conservatively:

RelationshipOn DeleteRationale
purchases → inventoryRESTRICTCannot delete inventory with purchase history
sales → customersRESTRICTCannot delete customers with sales history
sales → inventoryRESTRICTCannot delete inventory with sales history
ar_invoices → salesRESTRICTCannot delete sales with invoices
ar_payments → ar_invoicesRESTRICTCannot delete invoices with payments
requisitions → users (requested_by)RESTRICTCannot delete users who created requisitions
requisitions → users (approvers)SET NULLIf an approver is deleted, preserve the requisition
inventory_adjustments → usersRESTRICTCannot delete users who made adjustments
audit_log → usersRESTRICTCannot delete users with audit history

User Deactivation vs Deletion

ActionWhen to UseProcess
DeactivationEmployee leaves the companySet status to inactive, reassign pending work, review audit log
DeletionTest accounts, erroneous creation onlyAdmin approval required, ensure no dependent records

Deactivation Checklist:

  1. Set user status to inactive immediately
  2. Review recent audit log entries for the user
  3. Reassign any pending requisitions awaiting their approval
  4. Change any shared passwords they had access to
  5. Document the reason for deactivation in the user's notes field
  6. Retain the record for 7 years per retention policy

Privacy Considerations

Personal Data Inventory

Data CategoryData ElementsSourceRetention
Employee dataName, email, roleUser registrationEmployment + 7 years
Customer dataName, company, phone, email, addressCustomer onboarding7 years after last transaction
Supplier dataName, company, phone, email, addressSupplier onboarding7 years after last transaction
Transaction dataSales, purchases, paymentsBusiness operations7 years
Usage dataIP addresses, login timestampsAudit logIndefinite

Nigerian Data Protection Regulation (NDPR) 2019 Compliance

RequirementImplementation
Lawful basisAll data collected for legitimate business purposes (contractual necessity)
Purpose limitationData used only for ERP business functions — not repurposed
Data minimizationOnly necessary fields are collected and stored
AccuracyUsers can update their own records; admin manages others
Storage limitationRetention policies defined per data category (see above)
Integrity and confidentialitybcrypt passwords, parameterized queries, audit logging, TLS encryption
AccountabilityAudit trail tracks all data access and modifications
  • Employees: Consent obtained through employment contract (legitimate interest basis).
  • Customers: Consent obtained during business relationship establishment. Privacy notice provided.
  • Suppliers: Consent obtained through vendor registration process.
  • Marketing: If email marketing is added, explicit opt-in consent is required per NDPR.

Data Access Requests

Individuals have the right to request access to their personal data. The process:

  1. Request received: Individual submits a written request specifying the data they want to access.
  2. Identity verification: Verify the requester's identity before releasing data.
  3. Data compilation: Extract all personal data held about the individual from relevant tables.
  4. Response: Provide the data within 30 days (NDPR requirement).
  5. Documentation: Log the request and response in the audit trail.

Data sources to check for any individual:

  • users table (for employees)
  • customers table (for customers)
  • suppliers table (for suppliers)
  • sales table (customer transactions)
  • ar_invoices table (financial records)
  • ar_payments table (payment records)
  • audit_log table (activity history, filtered by user)

Data Portability

If requested, personal data can be exported in a machine-readable format (CSV or JSON). The system supports:

  • Customer data export via API (GET /api/customers/:id/statement)
  • Sales history export via API (GET /api/reports/consolidated)
  • Audit log export via API (GET /api/activity)

Data Classification

ClassificationExamplesAccess LevelProtection
PublicCompany name, product catalog, public websiteAnyoneStandard web security
InternalOperational data, inventory levels, production schedulesAuthenticated users (role-based)JWT authentication, RBAC
ConfidentialFinancial records, GL entries, P&L, balance sheet, customer balancesAccountant, AdminRole-based restriction, audit logging
RestrictedUser passwords (bcrypt hashes), API keys, JWT secrets, SSH keys, database credentialsSystem onlyEnvironment variables, file permissions, encryption at rest

Handling Rules

ClassificationStorageTransmissionDisposal
PublicAnyAnyDelete when obsolete
InternalEncrypted databaseHTTPS/TLSSoft delete, retain per policy
ConfidentialEncrypted databaseHTTPS/TLSSoft delete, retain 7 years minimum
RestrictedEncrypted/hashed, env varsHTTPS/TLS onlySecure overwrite, log the action

Incident Response

Data Breach Notification

Under the NDPR 2019, data breaches must be reported to the Nigerian Data Protection Commission (NDPC) within 72 hours of discovery.

Incident Response Steps

┌─────────────────────────────────────────────────────────┐
│ 1. DETECT │
│ - Monitor audit logs for anomalies │
│ - Review system alerts and error logs │
│ - User reports of suspicious activity │
├─────────────────────────────────────────────────────────┤
│ 2. CONTAIN │
│ - Isolate affected systems │
│ - Revoke compromised credentials immediately │
│ - Block suspicious IP addresses │
│ - Preserve evidence (logs, snapshots) │
├─────────────────────────────────────────────────────────┤
│ 3. ASSESS │
│ - Determine scope of the breach │
│ - Identify what data was exposed │
│ - Identify affected individuals │
│ - Determine root cause │
├─────────────────────────────────────────────────────────┤
│ 4. NOTIFY │
│ - Notify NDPC within 72 hours (if personal data) │
│ - Notify affected individuals │
│ - Notify company management │
│ - Engage legal counsel if needed │
├─────────────────────────────────────────────────────────┤
│ 5. REMEDIATE │
│ - Patch the vulnerability │
│ - Rotate all affected credentials │
│ - Update security configurations │
│ - Restore data from clean backups if needed │
├─────────────────────────────────────────────────────────┤
│ 6. DOCUMENT │
│ - Document the incident timeline │
│ - Record all actions taken │
│ - Create a post-incident report │
│ - Implement preventive measures │
└─────────────────────────────────────────────────────────┘

Documentation Requirements

Every incident must be documented with:

  • Date and time of discovery
  • Description of the incident
  • Data and systems affected
  • Root cause analysis
  • Actions taken to contain and remediate
  • Notifications sent (to whom, when, what)
  • Preventive measures implemented
  • Sign-off by management

Breach Severity Levels

LevelDescriptionResponse TimeExample
CriticalActive data exfiltration, system compromiseImmediate (within 1 hour)Unauthorized admin access, database exposure
HighConfirmed breach, limited scopeWithin 4 hoursSingle user account compromise, credential leak
MediumSuspected breach, unconfirmedWithin 24 hoursSuspicious login attempts, unusual data access
LowSecurity event, no breach confirmedWithin 72 hoursFailed login attempts, port scanning

Policy Review and Updates

Review TypeFrequencyResponsible
Full policy reviewAnnuallyManagement + IT
Backup restoration testMonthlyIT
Retention policy auditQuarterlyCompliance
Incident response drillSemi-annuallyIT + Management
Access control reviewMonthlyAdmin

Last Reviewed: July 2026 Next Review: July 2027 Document Owner: Lofty Golden Oil Ltd — IT / Compliance