PHPackages                             sencerhan/laravel-db-tools - 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. [Database &amp; ORM](/categories/database)
4. /
5. sencerhan/laravel-db-tools

ActiveLibrary[Database &amp; ORM](/categories/database)

sencerhan/laravel-db-tools
==========================

Generate Laravel migration and seeder files from existing database tables. Easily create migrations and seeders with a single command.

v1.1.0(1y ago)2536MITPHPPHP ^8.0

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sencerhan/laravel-database-tools)[ Packagist](https://packagist.org/packages/sencerhan/laravel-db-tools)[ RSS](/packages/sencerhan-laravel-db-tools/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (9)Dependencies (3)Versions (19)Used By (0)

Laravel DB Tools
================

[](#laravel-db-tools)

Database schema synchronization tool for Laravel that updates your database structure to match your migration files.

Features
--------

[](#features)

### Database Synchronizer (`db:fetch`)

[](#database-synchronizer-dbfetch)

- Updates existing database tables to match migration files
- Safe schema modifications with temporary table approach
- Robust handling of all MySQL column types
- Special handling for:
    - Decimal/Float with precision/scale
    - Enum/Set with value lists
    - Foreign keys and indexes
    - Laravel's special columns (timestamps, soft deletes)
- Progress tracking and detailed logging
- Data integrity verification

### Supported Column Types

[](#supported-column-types)

- **Numeric Types:** integer, bigInteger, decimal, float, double (with unsigned variants)
- **String Types:** char, varchar, text, mediumText, longText
- **Date/Time Types:** date, dateTime, timestamp, time (with timezone variants)
- **Special Types:** enum, set, json, binary
- **Laravel Types:** softDeletes, rememberToken, timestamps

Installation
------------

[](#installation)

```
composer require sencerhan/laravel-db-tools
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To update all tables:

```
php artisan db:fetch
```

To update specific tables:

```
php artisan db:fetch --tables=users,posts
```

### Debug Mode

[](#debug-mode)

Show detailed information about changes:

```
php artisan db:fetch --debug
```

### Force Mode

[](#force-mode)

Force schema changes even with constraints:

```
php artisan db:fetch --force
```

Key Features
------------

[](#key-features)

### 1. Safe Schema Updates

[](#1-safe-schema-updates)

- Uses temporary tables for risky operations
- Verifies data integrity after changes
- Automatic rollback on failure
- Preserves foreign key relationships

### 2. Column Handling

[](#2-column-handling)

- Precise type mapping between Laravel and MySQL
- Support for all modifiers (nullable, default, unique, etc.)
- Special handling for decimal precision/scale
- Proper enum/set value management

### 3. Constraint Management

[](#3-constraint-management)

- Safe foreign key handling
- Index recreation
- Smart constraint dependency resolution
- Automatic backup and restore

### 4. Data Protection

[](#4-data-protection)

- Preserves data during structure changes
- Validates data integrity after modifications
- Protects special Laravel columns
- Handles NOT NULL constraints safely

Error Handling
--------------

[](#error-handling)

The tool provides detailed error messages and:

- Shows exact SQL causing problems
- Maintains data integrity during errors
- Attempts to restore constraints after failures
- Provides debug information when needed

Examples
--------

[](#examples)

### Enum/Set Columns:

[](#enumset-columns)

```
// In your migration:
$table->enum('status', ['active', 'pending', 'cancelled']);
$table->set('permissions', ['read', 'write', 'delete']);
```

### Decimal/Float Columns:

[](#decimalfloat-columns)

```
$table->decimal('amount', 8, 2);
$table->unsignedDecimal('price', 10, 2);
$table->float('score', 8, 2);
```

### Special Modifiers:

[](#special-modifiers)

```
$table->string('name')->charset('utf8mb4')->collation('utf8mb4_unicode_ci');
$table->decimal('price', 8, 2)->unsigned();
$table->enum('level', ['basic', 'premium'])->default('basic')->nullable();
```

Requirements
------------

[](#requirements)

- Laravel 8.x or higher
- PHP 8.1 or higher
- MySQL 5.7 or higher

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance42

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~3 days

Total

18

Last Release

473d ago

### Community

Maintainers

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

---

Top Contributors

[![sencerhan](https://avatars.githubusercontent.com/u/10296139?v=4)](https://github.com/sencerhan "sencerhan (23 commits)")

---

Tags

laravelmigrationdatabasegeneratorseeder

### Embed Badge

![Health badge](/badges/sencerhan-laravel-db-tools/health.svg)

```
[![Health](https://phpackages.com/badges/sencerhan-laravel-db-tools/health.svg)](https://phpackages.com/packages/sencerhan-laravel-db-tools)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

438834.4k1](/packages/clickbar-laravel-magellan)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

442.1k](/packages/itpathsolutions-dbstan)[kdabrow/seeder-once

Run your laravel seeders only once

20172.4k](/packages/kdabrow-seeder-once)

PHPackages © 2026

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