BpmMigration - Changelog
Riwayat versi untuk BPM Migration
v0.4.1 (2025-12-23)
TL;DR
Perubahan:
- 🔥 Breaking:
foreignFor*()signatures changed (Breaking) - Parameter$columndihapus - ✨ Stub reorganization (High) - Separate CREATE vs ALTER stubs
- 🔧 Command improvements (Medium) - Auto-detect CREATE/ALTER operations
- 📝 Internal refactoring (Low) - Better code organization
Impact: 🔴 Breaking: 1 | 🟡 High: 1 | 🟢 Medium: 1 | 🔵 Low: 1
Backward Compatible: ❌ Tidak
🔴 Breaking Changes
foreignFor*() Methods: Removed $column Parameter
Parameter $column telah dihapus dari semua foreignFor*() methods karena bertentangan dengan tujuan auto-discovery. Jika column name di-override secara manual, parameter Model menjadi tidak berguna karena discovery-nya diabaikan.
Rasionale: Method foreignFor() dirancang untuk auto-discovery berdasarkan Model traits (HasUlids/HasUuids). Memberikan opsi override column name membuat parameter Model menjadi redundant dan membingungkan intent dari method.
// ❌ v0.4.0 - Parameter bertentangan
$table->foreignFor(Product::class, 'custom_name');
// ^ Discovery dari Model ^ Mengabaikan discovery
// ✅ v0.4.1 - Intent jelas: discovery
$table->foreignFor(Product::class);
// → Menghasilkan: product_id (auto-derived dari table name)Fix untuk custom column names:
// Opsi 1: Gunakan foreignTable*() explicit methods
$table->foreignTableUlid('products', 'custom_product_id');
// Opsi 2: Manual setup (full control)
$table->char('custom_product_id', 26);
$table->foreign('custom_product_id')
->references('id')
->on('products');
// Opsi 3: Gunakan constrainedFor() macro
$table->foreignUlid('custom_product_id')
->constrainedFor(Product::class);Affected methods:
foreignFor()- Signature:(string|Model $related, ?string $column = null)→(string|Model $related)foreignForId()- Signature:(string|Model $related, ?string $column = null)→(string|Model $related)foreignForUlid()- Signature:(string|Model $related, ?string $column = null, int $length = 26)→(string|Model $related, int $length = 26)foreignForUuid()- Signature:(string|Model $related, ?string $column = null)→(string|Model $related)
Catatan: Method foreignTable*() (preset dengan constraint) tetap mendukung parameter $column untuk custom names.
🟡 High Impact
Reorganisasi Stub Files
Stub files direorganisasi ke dalam subdirektori create/ dan alter/ dengan penambahan dedicated stub untuk table alteration. Command sekarang auto-detect operasi CREATE vs ALTER dan menggunakan stub yang sesuai.
Catatan: Stubs adalah internal library dan tidak di-publish ke project user.
🟢 Medium Impact
Peningkatan:
- Command
bpm:make:migrationauto-detect CREATE vs ALTER operation - Warning jika
--intatau--disable-soft-deletedigunakan untuk ALTER migrations
🔵 Low Impact
Perubahan internal:
- Refactoring
BpmBlueprintinternal helpers untuk DRY code - Penambahan helper methods:
createActorColumn(),dropActorColumn(),createForeignForColumn() - Rename protected methods untuk konsistensi:
foreignTablePresetDiscovery(),foreignTablePresetExplicit() - Better error messages dengan
InvalidArgumentExceptionuntuk invalid Model classes - Improved PHPDoc documentation
Upgrade
composer update bpmlib/bpm-migrationBreaking changes: 1 item - update foreignFor*() calls
Migration steps:
- Search and replace
foreignFor*()usage:
# Find usage
grep -r "foreignFor" database/migrations/
# Check if any have 2nd parameter (column name)
grep -r "foreignFor.*,.*)" database/migrations/- Update affected code:
// Before (v0.4.0)
$table->foreignFor(Product::class, 'main_product_id');
// After (v0.4.1) - Option A: Use foreignTable*()
$table->foreignTableUlid(Product::class, 'main_product_id');
// After (v0.4.1) - Option B: Manual
$table->foreignUlid('main_product_id')->constrainedFor(Product::class);Estimated time: 5-15 minutes per project (depending on usage)
Rollback: Downgrade ke v0.4.0 jika diperlukan:
composer require bpmlib/bpm-migration:^0.4.0v0.4.0 (2025-12-22)
TL;DR
Perubahan:
- ✨ Foreign Key Helper Methods (High) - 14 methods baru untuk relationship management
- 📝 BpmBlueprint enhancement (High) - Auto-detection tipe primary key dari Model
Impact: 🟡 High: 1 | 🔵 Low: 0
Backward Compatible: ✅ Ya
🟡 High Impact
Foreign Key Helper Methods
BpmBlueprint sekarang menyediakan 14 foreign key methods dengan auto-detection tipe primary key dari Model traits dan support untuk Model classes, mengeliminasi mismatch antara Model dan migration serta mengurangi boilerplate code untuk relationship management.
Poin utama:
- Auto-detection dari Model traits (HasUlids/HasUuids)
- 4 primitive methods (chainable, flexible)
- 10 preset methods (opinionated, quick setup)
- Model support (string|Model)
Lihat: BpmBlueprint Foreign Key Methods dan Examples 17-18
Primitive Methods (Chainable):
foreignFor()- Auto-detect type, no constraintforeignForId()- Force BIGINTforeignForUlid()- Force ULIDforeignForUuid()- Force UUID
Preset Methods (Opinionated):
foreignTable()/foreignTableNullable()- Auto-detect + constraintforeignTableId()/foreignTableIdNullable()- BIGINT + constraintforeignTableUlid()/foreignTableUlidNullable()- ULID + constraintforeignTableUuid()/foreignTableUuidNullable()- UUID + constraint
Upgrade
composer update bpmlib/bpm-migrationBreaking changes: Tidak ada
Opsional: Gunakan foreign key methods untuk relationship:
// Cara lama masih bekerja
$table->foreignId('product_id')->constrained();
// Cara baru - Auto-detect (opsional)
$table->foreignFor(Product::class)->constrained();
// Atau preset untuk quick setup
$table->foreignTable(Product::class);v0.3.0 (2025-12-22)
TL;DR
Perubahan:
- ✨ BpmSchema Model Support (High) - Terima Model instances/classes di schema operations
- 📝 Perbaikan PHPDoc (Low) - Dukungan IDE lebih baik
Impact: 🟡 High: 1 | 🔵 Low: 1
Backward Compatible: ✅ Ya
🟡 High Impact
BpmSchema Model Support
Method BpmSchema sekarang menerima Model instances atau class names selain string, memberikan type safety dan integrasi IDE yang lebih baik. Alih-alih risiko typo dengan string table name, kamu sekarang bisa menggunakan Model classes yang bisa di-autocomplete dan divalidasi oleh IDE.
Poin utama:
- Type-safe schema operations
- IDE autocomplete mencegah typo
- Bekerja dengan dynamic table names
Lihat: BpmSchema API Reference dan Example 16
🔵 Low Impact
Perubahan:
- Menambahkan PHPDoc komprehensif ke BpmSchema class
Upgrade
composer update bpmlib/bpm-migrationBreaking changes: Tidak ada
Opsional: Mulai gunakan Model classes di schema operations:
// Cara lama masih bekerja
BpmSchema::table('products', ...);
// Cara baru (opsional)
BpmSchema::table(Product::class, ...);v0.2.0 (2025-12-22)
TL;DR
Perubahan:
- ✨ Artisan Commands (High) - Scaffold migrations dan models
- 📦 Service Provider updated (Low) - Auto-register commands
Impact: 🟡 High: 2 | 🔵 Low: 1
Backward Compatible: ✅ Ya
🟡 High Impact
Artisan Command: bpm:make:migration
Generate BPM-style migrations dengan automatic stub selection berdasarkan preferensi kamu (ULID vs INT, with/without soft deletes), mengeliminasi boilerplate dan memastikan konsistensi di seluruh project.
Poin utama:
- 4 stub variants (ULID/INT × Soft/NoSoft)
- Auto-select berdasarkan options
- Generate migrations siap BpmSchema
Lihat: Artisan Commands dan Example 13
Artisan Command: bpm:make:model
Generate Eloquent models dengan BPM traits (HasUlids, SoftDeletes) dan opsional buat migration bersamaan, dengan Laravel 12 observer support menggunakan modern attribute syntax.
Poin utama:
- Auto-include HasUlids dan SoftDeletes
- Optional migration generation
- Laravel 12 observer attributes
Lihat: Artisan Commands dan Examples 14-15
🔵 Low Impact
Perubahan:
- Service Provider register commands baru secara otomatis
Upgrade
composer update bpmlib/bpm-migrationBreaking changes: Tidak ada
Verifikasi commands:
php artisan list | grep bpmOpsional: Gunakan commands untuk migrations/models baru