PHPackages                             merakilab/meraki-data-safety - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. merakilab/meraki-data-safety

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

merakilab/meraki-data-safety
============================

Data backup &amp; restore safety layer for Laravel migrations

v1.0.2(4mo ago)00MITPHPPHP ^8.2

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/meraki-labs/meraki-data-safety)[ Packagist](https://packagist.org/packages/merakilab/meraki-data-safety)[ RSS](/packages/merakilab-meraki-data-safety/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Meraki Data Safety
------------------

[](#meraki-data-safety)

### Purpose

[](#purpose)

#### Merika helps to manage the version of data

[](#merika-helps-to-manage-the-version-of-data)

### Preparation

[](#preparation)

```
composer require merakilab/meraki-data-safety

```

### Backup / restores a full table before migration down

[](#backup--restores-a-full-table-before-migration-down)

```
use Meraki\DataSafety\Traits\MigrationDataSafety;

return new class extends Migration {
    use MigrationDataSafety;

    const BACKUP_VERSION = '2026_01_03';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('table_name', function (Blueprint $table) {
            $table->id();
            $table->string('col1');
            $table->timestamps();
        });

        //Sync data backup to the table (if exists)
        $this->restoreTable('table_name', ['id'], self::BACKUP_VERSION);

        DB::statement("SELECT setval('table_name_id_seq', (SELECT MAX(id) FROM table_name))");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        //Backup before drop table
        $this->backupTable('table_name', ['id'], self::BACKUP_VERSION);

        Schema::dropIfExists('table_name');
    }
};
```

### Backup / restore data from columns

[](#backup--restore-data-from-columns)

```
use Meraki\DataSafety\Traits\MigrationDataSafety;

return new class extends Migration {
    use MigrationDataSafety;

    const BACKUP_VERSION = '2026_01_04_1754';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        DB::transaction(function () {
            if (!Schema::hasColumns('table_name', ['col2', 'col3'])) {
                Schema::table('table_name', function (Blueprint $table) {
                    $table->enum('col2', ['val1', 'val2'])->default("val1");
                    $table->string('col3')->nullable();
                });
                $this->restoreColumn('table_name', ['id'], ['col2', 'col3'], self::BACKUP_VERSION);
            }

            if (!Schema::hasColumns('table_name', ['col1'])) {
                $this->backupColumn('table_name', ['id'], ['col1'], self::BACKUP_VERSION);
                Schema::table('table_name', function (Blueprint $table) {
                    $table->dropColumn('col1');
                });
            }
        }, attempts: 5);
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        if (Schema::hasColumns('table_name', ['col2', 'col3'])) {
            $this->backupColumn('table_name', ['id'], ['col2', 'col3'], self::BACKUP_VERSION);
            Schema::table('table_name', function (Blueprint $table) {
                $table->dropColumn(['col2', 'col3']);
            });
        }

        if (!Schema::hasColumns('table_name', ['col1'])) {
            Schema::table('table_name', function (Blueprint $table) {
                $table->date('col1');
            });
            $this->restoreColumn('table_name', ['id'], ['col1'], self::BACKUP_VERSION);
        }
    }
};
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance76

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

129d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fe19f66932a59342a43aedca017bab2849bee09b7ffb04ef7a13d31e6fa97f84?d=identicon)[MerakiLabs](/maintainers/MerakiLabs)

---

Top Contributors

[![DouDangt](https://avatars.githubusercontent.com/u/5416883?v=4)](https://github.com/DouDangt "DouDangt (3 commits)")

### Embed Badge

![Health badge](/badges/merakilab-meraki-data-safety/health.svg)

```
[![Health](https://phpackages.com/badges/merakilab-meraki-data-safety/health.svg)](https://phpackages.com/packages/merakilab-meraki-data-safety)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
