Prod Deployment Preparation
This commit is contained in:
247
DATABASE_STATUS.md
Normal file
247
DATABASE_STATUS.md
Normal file
@@ -0,0 +1,247 @@
|
||||
# Database Status - LOAF Membership Platform
|
||||
|
||||
**Database:** `loaf_new`
|
||||
**Host:** 10.9.23.11:54321
|
||||
**Last Updated:** 2026-01-03
|
||||
**Status:** ✅ Fully initialized with seed data
|
||||
|
||||
---
|
||||
|
||||
## Database Summary
|
||||
|
||||
### Tables (18 total)
|
||||
|
||||
| Table Name | Status | Records | Purpose |
|
||||
|------------|--------|---------|---------|
|
||||
| ✅ alembic_version | Active | 1 | Migration tracking (001_initial_baseline) |
|
||||
| ✅ users | Active | 0 | User accounts and profiles |
|
||||
| ✅ events | Active | 0 | Event management |
|
||||
| ✅ event_rsvps | Active | 0 | Event RSVPs and attendance |
|
||||
| ✅ event_galleries | Active | 0 | Event photo galleries |
|
||||
| ✅ roles | Active | 5 | RBAC role definitions |
|
||||
| ✅ permissions | Active | 25 | RBAC permission definitions |
|
||||
| ✅ role_permissions | Active | 49 | Role-permission mappings |
|
||||
| ✅ user_invitations | Active | 0 | Admin invitation system |
|
||||
| ✅ subscriptions | Active | 0 | User subscriptions |
|
||||
| ✅ subscription_plans | Active | 3 | Available membership plans |
|
||||
| ✅ donations | Active | 0 | Donation tracking |
|
||||
| ✅ import_jobs | Active | 0 | CSV import tracking |
|
||||
| ✅ import_rollback_audit | Active | 0 | Import rollback audit trail |
|
||||
| ✅ newsletter_archives | Active | 0 | Newsletter document archive |
|
||||
| ✅ financial_reports | Active | 0 | Financial document archive |
|
||||
| ✅ bylaws_documents | Active | 0 | Bylaws document archive |
|
||||
| ✅ storage_usage | Active | 1 | Storage quota tracking (100GB limit) |
|
||||
|
||||
### ENUMs (8 total)
|
||||
|
||||
| ENUM Name | Values | Used By |
|
||||
|-----------|--------|---------|
|
||||
| ✅ userstatus | pending_email, awaiting_event, pre_approved, payment_pending, active, inactive | users.status |
|
||||
| ✅ userrole | guest, member, admin, finance, superadmin | users.role, user_invitations.role |
|
||||
| ✅ rsvpstatus | yes, no, maybe | event_rsvps.rsvp_status |
|
||||
| ✅ subscriptionstatus | active, past_due, canceled, incomplete, trialing | subscriptions.status |
|
||||
| ✅ donationtype | one_time, recurring, pledge, in_kind, memorial | donations.donation_type |
|
||||
| ✅ donationstatus | pending, completed, failed, refunded | donations.status |
|
||||
| ✅ invitationstatus | pending, accepted, expired, revoked | user_invitations.status |
|
||||
| ✅ importjobstatus | processing, completed, failed | import_jobs.status |
|
||||
|
||||
---
|
||||
|
||||
## Seed Data Loaded
|
||||
|
||||
### Roles (5)
|
||||
|
||||
| Code | Name | System Role | Permissions |
|
||||
|------|------|-------------|-------------|
|
||||
| admin | Admin | Yes | 16 |
|
||||
| finance | Finance | Yes | 7 |
|
||||
| guest | Guest | Yes | 0 |
|
||||
| member | Member | Yes | 1 |
|
||||
| superadmin | Super Admin | Yes | 25 |
|
||||
|
||||
### Permissions (25 across 5 modules)
|
||||
|
||||
**Users Module (6 permissions):**
|
||||
- users.view - View Users
|
||||
- users.create - Create Users
|
||||
- users.edit - Edit Users
|
||||
- users.delete - Delete Users
|
||||
- users.approve - Approve Users
|
||||
- users.import - Import Users
|
||||
|
||||
**Events Module (6 permissions):**
|
||||
- events.view - View Events
|
||||
- events.create - Create Events
|
||||
- events.edit - Edit Events
|
||||
- events.delete - Delete Events
|
||||
- events.publish - Publish Events
|
||||
- events.manage_attendance - Manage Attendance
|
||||
|
||||
**Finance Module (5 permissions):**
|
||||
- finance.view - View Financial Data
|
||||
- finance.manage_plans - Manage Subscription Plans
|
||||
- finance.manage_subscriptions - Manage Subscriptions
|
||||
- finance.view_reports - View Financial Reports
|
||||
- finance.export - Export Financial Data
|
||||
|
||||
**Content Module (3 permissions):**
|
||||
- content.newsletters - Manage Newsletters
|
||||
- content.documents - Manage Documents
|
||||
- content.gallery - Manage Gallery
|
||||
|
||||
**System Module (5 permissions):**
|
||||
- system.settings - System Settings
|
||||
- system.roles - Manage Roles
|
||||
- system.invitations - Manage Invitations
|
||||
- system.storage - Manage Storage
|
||||
- system.audit - View Audit Logs
|
||||
|
||||
### Subscription Plans (3)
|
||||
|
||||
| Plan Name | Price | Billing | Custom Pricing | Donation Support |
|
||||
|-----------|-------|---------|----------------|------------------|
|
||||
| Pay What You Want Membership | $30.00 (min) | Annual | ✅ Yes | ✅ Yes |
|
||||
| Annual Individual Membership | $60.00 | Annual | ❌ No | ❌ No |
|
||||
| Annual Group Membership | $100.00 | Annual | ❌ No | ❌ No |
|
||||
|
||||
**Note:** Stripe price IDs need to be configured after Stripe setup.
|
||||
|
||||
---
|
||||
|
||||
## Migration Status
|
||||
|
||||
**Current Revision:** `001_initial_baseline (head)`
|
||||
**Migration System:** Alembic 1.14.0
|
||||
**Schema Source:** `migrations/000_initial_schema.sql`
|
||||
**Seed Source:** `migrations/seed_data.sql`
|
||||
|
||||
**Migration History:**
|
||||
- `001_initial_baseline` - Empty baseline marker (2026-01-02)
|
||||
|
||||
**Future migrations** will be generated using:
|
||||
```bash
|
||||
alembic revision --autogenerate -m "description"
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
### Immediate (Required)
|
||||
|
||||
1. **Create Superadmin User**
|
||||
```bash
|
||||
cd backend
|
||||
python3 create_superadmin.py
|
||||
```
|
||||
|
||||
2. **Configure Stripe Price IDs**
|
||||
```sql
|
||||
UPDATE subscription_plans
|
||||
SET stripe_price_id = 'price_xxx'
|
||||
WHERE name = 'Annual Individual Membership';
|
||||
|
||||
UPDATE subscription_plans
|
||||
SET stripe_price_id = 'price_yyy'
|
||||
WHERE name = 'Annual Group Membership';
|
||||
|
||||
UPDATE subscription_plans
|
||||
SET stripe_price_id = 'price_zzz'
|
||||
WHERE name = 'Pay What You Want Membership';
|
||||
```
|
||||
|
||||
3. **Set Environment Variables**
|
||||
- Copy `backend/.env.example` to `backend/.env`
|
||||
- Fill in all required values (DATABASE_URL, JWT_SECRET, SMTP, Stripe, R2)
|
||||
|
||||
4. **Test Application**
|
||||
```bash
|
||||
# Backend
|
||||
cd backend
|
||||
uvicorn server:app --reload
|
||||
|
||||
# Frontend (separate terminal)
|
||||
cd frontend
|
||||
yarn start
|
||||
```
|
||||
|
||||
### Optional (Recommended)
|
||||
|
||||
1. **Add Sample Events**
|
||||
- Login as superadmin
|
||||
- Navigate to Admin → Events
|
||||
- Create 2-3 sample events
|
||||
|
||||
2. **Test Registration Flow**
|
||||
- Register a test user
|
||||
- Verify email verification works
|
||||
- Test event RSVP
|
||||
- Test admin approval flow
|
||||
|
||||
3. **Configure Email Templates**
|
||||
- Review templates in `backend/email_service.py`
|
||||
- Customize colors, branding, copy
|
||||
|
||||
4. **Set Up Monitoring**
|
||||
- Configure error logging
|
||||
- Set up uptime monitoring
|
||||
- Configure backup schedule
|
||||
|
||||
---
|
||||
|
||||
## Database Maintenance
|
||||
|
||||
### Backup Command
|
||||
|
||||
```bash
|
||||
PGPASSWORD='your-password' pg_dump -h 10.9.23.11 -p 54321 -U postgres loaf_new > backup_$(date +%Y%m%d_%H%M%S).sql
|
||||
```
|
||||
|
||||
### Restore Command
|
||||
|
||||
```bash
|
||||
PGPASSWORD='your-password' psql -h 10.9.23.11 -p 54321 -U postgres -d loaf_new < backup_file.sql
|
||||
```
|
||||
|
||||
### Health Check Queries
|
||||
|
||||
```sql
|
||||
-- Check user count by status
|
||||
SELECT status, COUNT(*) FROM users GROUP BY status;
|
||||
|
||||
-- Check upcoming events
|
||||
SELECT title, start_at FROM events WHERE start_at > NOW() ORDER BY start_at LIMIT 5;
|
||||
|
||||
-- Check active subscriptions
|
||||
SELECT COUNT(*) FROM subscriptions WHERE status = 'active';
|
||||
|
||||
-- Check storage usage
|
||||
SELECT
|
||||
total_bytes_used / 1024 / 1024 / 1024 as used_gb,
|
||||
max_bytes_allowed / 1024 / 1024 / 1024 as max_gb,
|
||||
ROUND((total_bytes_used::numeric / max_bytes_allowed * 100)::numeric, 2) as percent_used
|
||||
FROM storage_usage;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Support & Resources
|
||||
|
||||
- **Deployment Guide:** See `DEPLOYMENT.md` for complete deployment instructions
|
||||
- **API Documentation:** http://localhost:8000/docs (when backend running)
|
||||
- **Alembic Guide:** See `backend/alembic/README.md` for migration documentation
|
||||
- **Project Documentation:** See `CLAUDE.md` for codebase overview
|
||||
|
||||
---
|
||||
|
||||
## Changelog
|
||||
|
||||
**2026-01-03:**
|
||||
- ✅ Created all 17 data tables
|
||||
- ✅ Created all 8 ENUMs
|
||||
- ✅ Loaded seed data (5 roles, 25 permissions, 3 subscription plans)
|
||||
- ✅ Initialized Alembic tracking (001_initial_baseline)
|
||||
- ✅ Created superadmin user helper script
|
||||
|
||||
**Status:** Database is fully initialized and ready for use. Next step: Create superadmin user and start application.
|
||||
Reference in New Issue
Block a user