# No-Data-Loss Migration Plan

## Purpose

Move all current WooCommerce and Woo Accounting Stock Warehouse Manager data into the new standalone Laravel ERP without losing existing live store data.

## Golden Rule

Do not delete, truncate, overwrite, or disable the current WordPress plugin data until the Laravel system has been imported, reconciled, tested, and approved.

## Required Backups Before Import

Create and download these backups before any migration:

- Full WordPress database backup
- Full WordPress files backup
- Current WooCommerce product export
- Current WooCommerce order export
- Current plugin table export
- Current uploads folder backup

## Source Data

The existing source data is inside WordPress/WooCommerce and the current plugin tables.

Expected WordPress data:

- Products
- Product variations
- Customers
- Orders
- Order items
- Refunds
- Product stock fields

Expected plugin data:

- Suppliers
- Warehouses
- Stock batches
- Purchase records
- Purchase items
- Stock movements
- Barcode labels
- Expenses
- Payments
- Courier payment imports
- Sales invoices
- Receivables
- Returns
- Accounts
- Journals
- Journal lines
- Bank accounts
- Bank reconciliations
- Settings

## Migration Phases

### Phase 1: Read-Only Snapshot

Connect Laravel to a copied WordPress database or exported SQL file.

Do not connect directly to the live database for first import testing.

### Phase 2: Mapping

Map every WordPress/plugin table to Laravel tables.

Every imported row should store:

- Source table name
- Source row ID
- Source order/product ID where applicable
- Import batch ID
- Import timestamp

This allows safe re-checking and prevents duplicate imports.

### Phase 3: Trial Import

Import into a clean Laravel test database.

Verify:

- Product count
- Variation count
- Supplier count
- Warehouse count
- Batch count
- Purchase total
- Stock valuation total
- Receivable total
- Courier collection total
- Bank book balance
- Trial balance
- Profit and loss
- Balance sheet

### Phase 4: Reconciliation

Compare WordPress/plugin totals against Laravel totals.

Required checks:

- Current stock value
- Total purchase value
- Supplier due
- Customer receivable due
- Bank balance
- Cash balance
- Courier payment received
- Number of WooCommerce orders
- Number of invoices
- Journal debit total equals journal credit total

### Phase 5: Parallel Run

Keep the current WordPress plugin active while Laravel runs in read-only or shadow mode.

New orders sync to Laravel, but WordPress remains the live source until approval.

### Phase 6: Cutover

After approval:

- Laravel becomes the main accounting and stock system.
- WordPress connector keeps WooCommerce stock status updated.
- Heavy accounting logic is disabled in WordPress.

## What Must Never Happen

- No direct deletion of live WordPress data.
- No blind overwrite of product stock.
- No stock reset without reconciliation.
- No receivable deletion without order mapping.
- No journal import without debit/credit validation.
- No courier duplicate import without invoice/tracking uniqueness check.

## Recommended First Import Order

1. Business settings
2. Users and roles
3. Chart of accounts
4. Suppliers
5. Customers
6. Warehouses
7. Products and variations
8. Purchases
9. Stock batches
10. Stock movements
11. Sales invoices
12. Receivables
13. Courier payments
14. Expenses
15. Payments
16. Bank accounts
17. Bank reconciliations
18. Returns
19. Journals and journal lines
20. Final reconciliation totals

## Data Safety Status

Laravel has been installed, but live data has not yet been migrated.

The next required step is to provide a database backup or staging database access so the importer can be built and tested safely.
