承接 aldoggutierrez/laravel-schema-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aldoggutierrez/laravel-schema-manager

Composer 安装命令:

composer require aldoggutierrez/laravel-schema-manager

包简介

Manage PostgreSQL schemas in Laravel applications

README 文档

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. Generate versioned schema migrations and dump the full database schema to a SQL file.

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

Generate a schema migration

Creates a versioned migration file that moves a table between schemas using ALTER TABLE … SET SCHEMA. The generated migration also handles any sequences attached to the table.

# Specify schemas explicitly
php artisan make:schema-migration orders --from=external --to=public

# Omit options to be prompted interactively
php artisan make:schema-migration orders

The generated file is placed in database/migrations/ with a timestamped name such as 2024_01_01_120000_move_orders_from_external_to_public.php. It contains both up() and down() methods so the move is fully reversible.

Dump the database schema

Exports the PostgreSQL schema (DDL) for one or more schemas to a SQL file using pg_dump. Useful for keeping a schema snapshot in version control and for seeding fresh environments without running every historical migration.

Requires pg_dump to be installed and accessible on $PATH.

# Dump the default pgsql connection (uses search_path, falls back to public)
php artisan schema:dump

# Specify a custom connection
php artisan schema:dump --database=tenant

# Dump specific schemas
php artisan schema:dump --schemas=billing,reports

# Write to a custom path
php artisan schema:dump --path=/tmp/schema.sql

# Prune existing migration files after dumping
php artisan schema:dump --prune

Options

Option Default Description
--database pgsql Laravel database connection to use
--schemas connection search_path or public Comma-separated list of schemas to dump
--path database/schema/{connection}-schema.sql Output file path
--prune Delete all files in database/migrations/ after the dump

The command writes two sections to the output file:

  1. Schema-only DDL (pg_dump --schema-only) for all requested schemas.
  2. Data rows from the migrations table so Laravel knows which migrations have already been run.

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 ✅ Generate reversible schema migration files ✅ Dump the full schema (DDL + migrations data) to a SQL file

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.

aldoggutierrez/laravel-schema-manager 适用场景与选型建议

aldoggutierrez/laravel-schema-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.32k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「schema」 「postgresql」 「migration」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 aldoggutierrez/laravel-schema-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aldoggutierrez/laravel-schema-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 aldoggutierrez/laravel-schema-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13