Garment.id
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
Home
Core APITenant APISupport CenterChangelog
Home
Core APITenant APISupport CenterChangelog
Github
Instagram
|
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
  1. Home
  • Introduction
  • 01 - Project Structure
  • 02 - Context Boundaries
  • 03 - Central Auth Runtime
  • 04 - Central Billing
  • 05 - Tenant Runtime
  • 06 - FE Integration Contracts
  • 07 - Security, Middleware, and RLS
  • 08 - Events, Jobs, Listeners, Notifications, Observers
  • 09 - Testing and Quality Gates
  • 10 - Operations Runbook
  • 11 - Architecture Decisions (ADR Ringkas)
  • 12 - API Endpoint Catalog (v1)
  • 13 - Class Catalog by Context
  • 14 - Feature Development Playbook
  • 15 - Migration and Model Conventions
  • 16 - Service, Support, and Trait Contracts
  • 17 - Auth Business Scenarios and Decision Tree
  • 18 - Config Reference and Impact
  • 19 - Migration and Model Cookbook
  • 20 - Billing and Provisioning Business Flows
  • 21 - FE Error Handling Matrix
  • 22 - Incident Playbooks
  • 23 - Data Ownership Matrix
  • 24 - Documentation Governance and Changelog
  • 25 - Tenant Authorization Backend Guide
Home
Core APITenant APISupport CenterChangelog
Home
Core APITenant APISupport CenterChangelog
Github
Instagram
|
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
🇺🇸 English
  • 🇮🇩 Indonesian
  • 🇺🇸 English
  1. Home

19 - Migration and Model Cookbook

Dokumen ini berisi contoh praktikal migration/model untuk central dan tenant.

A. Central Migration Template#

Kapan dipakai: data global platform (auth, billing source-of-truth, tenant registry).

B. Tenant Migration Template#

Kapan dipakai: data operasional tenant.

B2. Tenant Migration Pattern (Owner Access Policy)#

Contoh pattern tambahan seperti pada tenant_user:
Kapan dipakai:
ketika tenant role tertentu (owner/admin) butuh visibilitas lebih luas di tenant yang sama.

C. Central Model Template#

D. Tenant Model Template#

E. Rules of Thumb#

Jangan simpan table tenant operasional di folder migration central.
Jangan query model tenant dari central flow tanpa boundary/context.
Tenant model gunakan HasTenantClusterConnection jika runtime tenant-scoped.
Selalu tambah test untuk migration impact pada path domain terkait.

F. Real Project References#

tenant membership + owner policy:
database/migrations/tenant/2026_02_14_032023_create_tenant_user_table.php
tenant taxonomy + basic tenant isolation policy:
database/migrations/tenant/2026_02_25_000039_create_taxonomies_table.php
RLS helper trait:
app/Support/Database/Concerns/InteractsWithPostgresRls.php
Diubah pada 2026-03-03 22:25:30
Sebelumnya
18 - Config Reference and Impact
Berikutnya
20 - Billing and Provisioning Business Flows
Built with