jamoliddin/pgschema
Composer 安装命令:
composer require jamoliddin/pgschema
包简介
postgresql schemas for laravel 10
README 文档
README
This is very useful when you are working with multi-tenants applications with PostgreSQL Schemas.
With facade helper functions, you can create/drop/switch schemas easily. This package also provide artisan commands for migrations and seeds supports for each schemas.
PGSchema will check and only affects when specific connection driver is pgsql.
So you can using PGSchema to your projects safely with any database connection drivers without error occurred.
Laravel version
Current package version works for Laravel 10 .
Installation
- Use composer to add the package into your project
composer require jamoliddin/pgschema
- Add service provider into your providers array in
config/app.php
Racklin\PGSchema\PGSchemaServiceProvider::class,
- Add alias to aliases array in
config/app.php
'PGSchema' => Racklin\PGSchema\Facades\PGSchema::class,
Artisan Commands
pgschema:migrate
pgschema:migrate add extra schema option to Laravel migrate command, you can specific the database schema for migrations.
And it will auto install migrations repository table for the schema.
Usage:
pgschema:migrate [options]
Options:
--database[=DATABASE] The database connection to use.
--schema[=SCHEMA] The database schema to use.
--force Force the operation to run when in production.
--path[=PATH] The path of migrations files to be executed.
--pretend Dump the SQL queries that would be run.
--seed Indicates if the seed task should be re-run.
--step Force the migrations to be run so they can be rolled back individually.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Run the database migrations
pgschema:rollback
pgschema:rollback add extra schema option to Laravel migrate:rollback command.
Usage:
pgschema:rollback [options]
Options:
--database[=DATABASE] The database connection to use.
--force Force the operation to run when in production.
--path[=PATH] The path of migrations files to be executed.
--pretend Dump the SQL queries that would be run.
--step[=STEP] The number of migrations to be reverted.
--schema[=SCHEMA] The database schema to use
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Rollback the last database migration
pgschema:reset
pgschema:reset add extra schema option to Laravel migrate:reset command.
Usage:
pgschema:reset [options]
Options:
--database[=DATABASE] The database connection to use.
--force Force the operation to run when in production.
--path[=PATH] The path of migrations files to be executed.
--pretend Dump the SQL queries that would be run.
--schema[=SCHEMA] The database schema to use
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Rollback all database migrations
pgschema:refresh
pgschema:refresh add extra schema option to Laravel migrate:refresh command.
Usage:
pgschema:refresh [options]
Options:
--database[=DATABASE] The database connection to use.
--force Force the operation to run when in production.
--path[=PATH] The path of migrations files to be executed.
--seed Indicates if the seed task should be re-run.
--seeder[=SEEDER] The class name of the root seeder.
--step[=STEP] The number of migrations to be reverted & re-run.
--schema[=SCHEMA] The database schema to use
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Reset and re-run all migrations
pgschema:seed
pgschema:seed add extra schema option to Laravel db:seed command.
Usage:
pgschema:seed [options]
Options:
--class[=CLASS] The class name of the root seeder [default: "DatabaseSeeder"]
--database[=DATABASE] The database connection to seed
--schema[=SCHEMA] The database schema to seed
--force Force the operation to run when in production.
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Seed the database with records
pgschema:create-schema
pgschema:create-schema create schema for database .
Usage:
pgschema:create-schema [options] [--] <schema>
Arguments:
schema The database schema to create
Options:
--database[=DATABASE] The database connection to use
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Facade Helper Functions
Create new Schema
PGSchema::create($schemaName, $databaseName)
if create is call without $databaseName argument, it using the default connection.
Drop Schema
PGSchema::drop($schemaName, $databaseName)
if drop is call without $databaseName argument, it using the default connection.
Switch Schema
PGSchema::schema($schemaName, $databaseName)
if schema is call without $schemaName argument, it switches to the public schema (default) if schema is call without $databaseName argument, it using the default connection.
Iterating Schemas
PGSchema::each(Closure $callback, $databaseName)
if each is call without $databaseName argument, it using the default connection.
License
jamoliddin/pgschema 适用场景与选型建议
jamoliddin/pgschema 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「postgres」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jamoliddin/pgschema 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jamoliddin/pgschema 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jamoliddin/pgschema 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bundle for Doctrine enumerations extension for Postgres
Doctrine extension to manage enumerations in PostgreSQL
Mapper for accessing resources in KWCMS
Laravel PostgreSQL connection pool
VV database abstraction layer with query builder and DB structure models
Alfabank REST API integration
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-03