# Deploy GCMA to https://gcma.ait-academy.com

## 1. Upload code

Upload the project files to the hosting document root (or subdomain folder), including:

- `app/`, `config/`, `public/`, `routes/`, `database/`, `vendor/` (or run `composer install --no-dev` on server)
- Point the web root to the `public/` folder when possible

## 2. Configure environment

Copy `.env.production.example` to `.env` on the server and set:

- `APP_URL=https://gcma.ait-academy.com`
- `APP_ENV=production`
- `APP_DEBUG=false`
- Real `DB_*` credentials from hosting panel
- Strong `JWT_SECRET`

## 3. Database (existing production with data)

In phpMyAdmin on the production database, import:

`database/deploy/02_production_upgrade_existing.sql`

This upgrades schema/permissions/prefix examples safely without wiping business data.

## 4. Database (brand-new empty DB only)

1. Import `database/deploy/gcma_production_schema.sql`
2. Import `database/deploy/gcma_production_master_seed.sql`
3. Create admin: `php database/seed_admin.php`

## 5. Smoke test after deploy

- Login
- Master Data → Color Add/Edit
- Users & Permissions → Save role matrix
- Item Code → open Fabric / Pocketing / Thread / Label / Badge-Patch
- Master Data → Warehouse

## 6. Rebuild deploy dumps from local (optional)

```bash
php database/deploy/build_production_package.php
```
