wpdiggerstudio/wpzylos-migrations

dbDelta-based migration runner for WPZylos framework

Fund package maintenance!
Paypal

Installs: 257

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/wpdiggerstudio/wpzylos-migrations

v1.0.0 2026-02-01 13:02 UTC

This package is auto-updated.

Last update: 2026-02-01 13:03:49 UTC


README

PHP Version License GitHub

dbDelta-based migration runner for WPZylos framework.

📖 Full Documentation | 🐛 Report Issues

✨ Features

  • dbDelta Integration — Uses WordPress dbDelta for safe schema changes
  • Version Tracking — Tracks migration history
  • Up/Down Methods — Reversible migrations
  • CLI Support — Run migrations via WP-CLI
  • Schema Builder — Fluent table schema definition

📋 Requirements

Requirement Version
PHP ^8.0
WordPress 6.0+

🚀 Installation

composer require wpdiggerstudio/wpzylos-migrations

📖 Quick Start

use WPZylos\Framework\Migrations\Migration;
use WPZylos\Framework\Database\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('products', function ($table) {
            $table->id();
            $table->string('name');
            $table->decimal('price', 10, 2);
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('products');
    }
};

🏗️ Core Features

Schema Builder

Schema::create('orders', function ($table) {
    $table->id();
    $table->bigInteger('user_id')->unsigned();
    $table->string('status', 50)->default('pending');
    $table->decimal('total', 12, 2);
    $table->text('notes')->nullable();
    $table->timestamps();

    $table->index('user_id');
    $table->index('status');
});

Column Types

$table->id();                          // BIGINT UNSIGNED AUTO_INCREMENT
$table->string('name', 255);           // VARCHAR(255)
$table->text('content');               // TEXT
$table->integer('count');              // INT
$table->bigInteger('amount');          // BIGINT
$table->decimal('price', 10, 2);       // DECIMAL(10,2)
$table->boolean('active');             // TINYINT(1)
$table->datetime('published_at');      // DATETIME
$table->timestamps();                  // created_at, updated_at

Running Migrations

$migrator = new Migrator($context);
$migrator->run();       // Run pending migrations
$migrator->rollback();  // Rollback last batch

📦 Related Packages

Package Description
wpzylos-core Application foundation
wpzylos-database Query builder
wpzylos-scaffold Plugin template

📖 Documentation

For comprehensive documentation, tutorials, and API reference, visit wpzylos.com.

☕ Support the Project

If you find this package helpful, consider buying me a coffee! Your support helps maintain and improve the WPZylos ecosystem.

Donate with PayPal

📄 License

MIT License. See LICENSE for details.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Made with ❤️ by WPDiggerStudio