Contents
Table of Contents
Database Schema
MokoSuiteStorage creates 8 tables in the Joomla database, all prefixed with #__mokosuitestorage_. All tables use InnoDB engine with utf8mb4_unicode_ci collation.
Tables Overview
| Table | Purpose | Key Relationships |
|---|---|---|
unit_types |
Storage unit size/feature templates | Referenced by units |
units |
Individual storage units | FK to unit_types |
tenants |
Tenant contact records | FK to CRM contacts (via contact_id) |
leases |
Rental agreements linking tenants to units | FK to tenants, units |
payments |
Payment transaction records | FK to leases, tenants |
access_logs |
Gate entry/exit activity log | FK to tenants, units |
gate_codes |
Tenant gate access codes | FK to tenants |
move_ins |
Move-in/move-out inspection records | FK to leases, tenants, units |
Entity Relationship
unit_types 1──* units
tenants 1──* leases *──1 units
tenants 1──* payments *──1 leases
tenants 1──* gate_codes
tenants 1──* access_logs
leases 1──* move_ins
tenants ──── CRM contacts (via contact_id)
Table Details
#__mokosuitestorage_unit_types
Defines unit size categories and pricing templates.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
name |
VARCHAR(255) | Type name (e.g. "10x10 Climate") |
description |
TEXT | Description |
width_ft |
DECIMAL(6,1) | Width in feet |
depth_ft |
DECIMAL(6,1) | Depth in feet |
height_ft |
DECIMAL(6,1) | Height in feet |
square_feet |
DECIMAL(8,1) | Calculated area |
climate_controlled |
TINYINT(1) | Climate control flag |
drive_up |
TINYINT(1) | Drive-up access flag |
indoor |
TINYINT(1) | Indoor unit flag |
floor_level |
INT | Default floor level |
rate_monthly |
DECIMAL(10,2) | Standard monthly rate |
rate_annual |
DECIMAL(10,2) | Annual rate (optional) |
deposit_amount |
DECIMAL(10,2) | Required deposit |
active |
TINYINT(1) | Active/inactive |
ordering |
INT | Display order |
Indexes: idx_active, idx_climate
#__mokosuitestorage_units
Individual storage units within facilities.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
unit_type_id |
INT UNSIGNED FK | References unit_types.id |
unit_number |
VARCHAR(20) UNIQUE | Unit identifier |
building |
VARCHAR(50) | Building designation |
floor |
INT | Floor number |
status |
ENUM | available, occupied, reserved, maintenance, out_of_service |
rate_override |
DECIMAL(10,2) | Overrides unit_type rate if set |
notes |
TEXT | Internal notes |
Indexes: idx_unit_number (UNIQUE), idx_unit_type, idx_status, idx_building
FK: fk_unit_type → unit_types(id) ON DELETE CASCADE
#__mokosuitestorage_tenants
Tenant records, optionally linked to CRM contacts.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
contact_id |
INT UNSIGNED | FK to CRM contacts table |
first_name |
VARCHAR(100) | First name |
last_name |
VARCHAR(100) | Last name |
company |
VARCHAR(255) | Business name |
email |
VARCHAR(255) | Email address |
phone |
VARCHAR(50) | Phone number |
address |
TEXT | Mailing address |
id_type |
VARCHAR(50) | ID document type |
id_number |
VARCHAR(100) | ID document number |
emergency_contact_name |
VARCHAR(255) | Emergency contact |
emergency_contact_phone |
VARCHAR(50) | Emergency phone |
status |
ENUM | active, inactive, delinquent, evicted |
notes |
TEXT | Internal notes |
Indexes: idx_contact, idx_status, idx_name, idx_email
#__mokosuitestorage_leases
Rental agreements between tenants and units.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
tenant_id |
INT UNSIGNED FK | References tenants.id |
unit_id |
INT UNSIGNED FK | References units.id |
lease_number |
VARCHAR(50) UNIQUE | Lease identifier |
start_date |
DATE | Lease start |
end_date |
DATE | Lease end (null = month-to-month) |
monthly_rate |
DECIMAL(10,2) | Monthly rental rate |
deposit_amount |
DECIMAL(10,2) | Security deposit held |
deposit_status |
ENUM | held, partially_refunded, refunded, forfeited |
billing_day |
INT UNSIGNED | Day of month for billing (default: 1) |
auto_renew |
TINYINT(1) | Auto-renewal flag |
status |
ENUM | active, expired, terminated, pending |
termination_reason |
TEXT | Reason for termination |
Indexes: idx_tenant, idx_unit, idx_status, idx_dates, idx_lease_number (UNIQUE)
FK: fk_lease_tenant → tenants(id), fk_lease_unit → units(id) — both ON DELETE CASCADE
#__mokosuitestorage_payments
Payment transaction records for leases.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
lease_id |
INT UNSIGNED FK | References leases.id |
tenant_id |
INT UNSIGNED FK | References tenants.id |
amount |
DECIMAL(10,2) | Payment amount |
payment_type |
ENUM | rent, deposit, late_fee, other |
payment_method |
VARCHAR(50) | Payment method |
payment_date |
DATE | Date paid |
due_date |
DATE | Date due |
status |
ENUM | pending, completed, failed, refunded, void |
transaction_id |
VARCHAR(100) | External transaction reference |
notes |
TEXT | Payment notes |
Indexes: idx_lease, idx_tenant, idx_status, idx_payment_date, idx_due_date
FK: fk_payment_lease → leases(id), fk_payment_tenant → tenants(id) — both ON DELETE CASCADE
#__mokosuitestorage_access_logs
Records gate entry/exit and unit access events.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
tenant_id |
INT UNSIGNED | Tenant who accessed |
unit_id |
INT UNSIGNED | Unit accessed |
gate_code_id |
INT UNSIGNED | Gate code used |
access_type |
ENUM | gate_entry, gate_exit, unit_unlock, unit_lock |
access_point |
VARCHAR(100) | Physical access point |
access_time |
DATETIME | When access occurred |
method |
ENUM | gate_code, key_card, manual, override |
granted |
TINYINT(1) | Whether access was granted |
notes |
TEXT | Additional notes |
Indexes: idx_tenant, idx_unit, idx_access_time, idx_access_type, idx_granted
#__mokosuitestorage_gate_codes
Gate access codes assigned to tenants.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
tenant_id |
INT UNSIGNED FK | References tenants.id |
code |
VARCHAR(20) UNIQUE | Gate code value |
code_type |
ENUM | permanent, temporary, master |
gate |
VARCHAR(100) | Assigned gate |
active |
TINYINT(1) | Active status |
valid_from |
DATETIME | Validity start |
valid_until |
DATETIME | Validity end |
last_used |
DATETIME | Last usage timestamp |
Indexes: idx_code (UNIQUE), idx_tenant, idx_active, idx_code_type
FK: fk_gatecode_tenant → tenants(id) ON DELETE CASCADE
#__mokosuitestorage_move_ins
Move-in and move-out inspection records.
| Column | Type | Description |
|---|---|---|
id |
INT UNSIGNED PK | Auto-increment |
lease_id |
INT UNSIGNED FK | References leases.id |
tenant_id |
INT UNSIGNED FK | References tenants.id |
unit_id |
INT UNSIGNED FK | References units.id |
move_type |
ENUM | move_in, move_out |
scheduled_date |
DATE | Scheduled inspection date |
actual_date |
DATE | Actual completion date |
condition_notes |
TEXT | Unit condition description |
photos |
JSON | Photo references |
status |
ENUM | scheduled, completed, cancelled |
inspection_passed |
TINYINT(1) | Inspection result |
user_id |
INT UNSIGNED | Staff who performed inspection |
Indexes: idx_lease, idx_tenant, idx_unit, idx_status, idx_move_type, idx_scheduled_date
FK: fk_movein_lease → leases(id), fk_movein_tenant → tenants(id), fk_movein_unit → units(id) — all ON DELETE CASCADE