定制 pacuna/schemas 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pacuna/schemas

Composer 安装命令:

composer require pacuna/schemas

包简介

Laravel package for managing postgresql schemas

README 文档

README

[LOOKING FOR MAINTAINER]

Please contact me if you are interested in maintaining this library. I no longer work with Laravel so I'm not able to keep up with the updates.

Laravel PGSchema

With this package you can create, switch and drop postgresql schemas easily. This is very useful when you are working with multi-tenants applications.

Installation

  1. Use composer to add the package into your project using composer require pacuna/schemas:dev-master

  2. Add 'Pacuna\Schemas\SchemasServiceProvider' to your app.php file in the services providers section.

  3. Add 'PGSchema' => 'Pacuna\Schemas\Facades\PGSchema' into the aliases section

Usage

Assuming that you have your db configuration ready, meaning that your default connection is 'pgsql' and your pgsql credentials are setted in the usual way, you can use the next functions:

Create new Schema

PGSchema::create($schemaName)

Switch to Schema

PGSchema::switchTo($schemaName)

if switchTo is call without arguments, it switches to the public schema (default)

Drop Schema

PGSchema::drop($schemaName)

Migrate Schema

PGSchema::migrate($schemaName, args[])

For example create a migrations in a custom path: php artisan migrate:make create_dogs_table --create=dogs --path=app/database/migrations/foo

Then you can migrate some schema using this path PGSchema::migrate($schemaName, ['--path' => 'app/database/migrations/foo'])

Multi-tenancy Example (SaaS)

Checkout this repo https://github.com/pacuna/laravel-multitenancy-schemas In the handlers folder you can find the code that contains calls to the package.

Laravel version

Current package version works for Laravel 5. If you need Laravel 4 support checkout for the laravel4 branch.

统计信息

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

GitHub 信息

  • Stars: 42
  • Watchers: 6
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-01-06