aldoggutierrez/laravel-schema-manager

Manage PostgreSQL schemas in Laravel applications

Fund package maintenance!
Aldoggutierrez

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/aldoggutierrez/laravel-schema-manager

v1.0.0 2026-02-13 22:00 UTC

This package is auto-updated.

Last update: 2026-02-13 23:32:14 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Manage PostgreSQL schemas in Laravel applications with ease. Move tables between schemas while preserving foreign keys and relationships.

Installation

You can install the package via composer:

composer require aldoggutierrez/laravel-schema-manager

Configuration

Publish the configuration file:

php artisan vendor:publish --tag="schema-manager-config"

Available options in config/schema-manager.php:

return [
    'default_source_schema' => env('SCHEMA_MANAGER_SOURCE', 'external'),
    'default_destination_schema' => env('SCHEMA_MANAGER_DESTINATION', 'public'),
    'connection' => env('SCHEMA_MANAGER_CONNECTION', null),
    'log_queries' => env('SCHEMA_MANAGER_LOG_QUERIES', false),
];

These are the contents of the published config file:

return [
    /*
     * Default source schema when moving tables
     */
    'default_source_schema' => env('SCHEMA_MANAGER_SOURCE', 'external'),

    /*
     * Default destination schema when moving tables
     */
    'default_destination_schema' => env('SCHEMA_MANAGER_DESTINATION', 'public'),

    /*
     * Database connection to use (leave null to use default)
     */
    'connection' => env('SCHEMA_MANAGER_CONNECTION', null),

    /*
     * Enable query logging during operations
     */
    'log_queries' => env('SCHEMA_MANAGER_LOG_QUERIES', false),
];

Usage

Move a table between schemas

# Basic usage (uses config defaults)
php artisan schema:move-table authorized_charges

# Specify source and destination
php artisan schema:move-table users --from=external --to=public

# Preview changes without executing
php artisan schema:move-table orders --dry-run

# Skip confirmation prompt
php artisan schema:move-table products --force

List tables in schemas

# List tables in default schema
php artisan schema:list-tables

# List tables in specific schema
php artisan schema:list-tables external

# List all schemas and their tables
php artisan schema:list-tables --all

Features

✅ Move tables between PostgreSQL schemas
✅ Automatically handles foreign key constraints
✅ Preserves all relationships (ON UPDATE/DELETE rules)
✅ Cross-schema foreign key support
✅ Dry-run mode to preview changes
✅ Transaction-based for safety
✅ List tables and schemas

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.