{"id":18410239,"url":"https://github.com/racklin/pgschema","last_synced_at":"2025-06-16T03:06:28.746Z","repository":{"id":51718392,"uuid":"88184958","full_name":"racklin/pgschema","owner":"racklin","description":"PostgreSQL Schema manager for Laravel 5+","archived":false,"fork":false,"pushed_at":"2023-07-03T06:27:42.000Z","size":23,"stargazers_count":20,"open_issues_count":3,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-18T02:58:30.215Z","etag":null,"topics":["laravel","laravel-5-package","laravel5-package","multi-tenancy","postgresql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/racklin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-13T16:28:23.000Z","updated_at":"2023-03-05T19:25:09.000Z","dependencies_parsed_at":"2022-08-22T12:51:04.699Z","dependency_job_id":null,"html_url":"https://github.com/racklin/pgschema","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racklin%2Fpgschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racklin%2Fpgschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racklin%2Fpgschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/racklin%2Fpgschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/racklin","download_url":"https://codeload.github.com/racklin/pgschema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223277557,"owners_count":17118590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-5-package","laravel5-package","multi-tenancy","postgresql"],"created_at":"2024-11-06T03:30:05.271Z","updated_at":"2024-11-06T03:30:05.944Z","avatar_url":"https://github.com/racklin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSQL Schema manager for Laravel\n\nThis is very useful when you are working with multi-tenants\napplications with PostgreSQL Schemas.\n\nWith facade helper functions, you can create/drop/switch schemas easily.\nThis package also provide artisan commands for migrations and seeds supports for each schemas.\n \nPGSchema will check and only affects when specific connection driver is `pgsql`.\nSo you can using PGSchema to your projects safely with any database connection drivers without error occurred.\n\n## Laravel version\n\nCurrent package version works for Laravel `5+` .\n\n\n## Installation\n\n1. Use composer to add the package into your project\n```\ncomposer require racklin/pgschema:dev-master\n```\n\n2. Add service provider into your providers array in `config/app.php`\n```\nRacklin\\PGSchema\\PGSchemaServiceProvider::class,\n```\n\n3. Add alias to aliases array in `config/app.php`\n```\n'PGSchema' =\u003e Racklin\\PGSchema\\Facades\\PGSchema::class,\n```\n\n## Artisan Commands\n### pgschema:migrate\n`pgschema:migrate` add extra `schema` option to Laravel `migrate` command, you can specific the database schema for migrations.\n And it will auto install `migrations` repository table for the schema.\n```\nUsage:\n  pgschema:migrate [options]\n\nOptions:\n      --database[=DATABASE]  The database connection to use.\n      --schema[=SCHEMA]      The database schema to use.\n      --force                Force the operation to run when in production.\n      --path[=PATH]          The path of migrations files to be executed.\n      --pretend              Dump the SQL queries that would be run.\n      --seed                 Indicates if the seed task should be re-run.\n      --step                 Force the migrations to be run so they can be rolled back individually.\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Run the database migrations\n```\n\n### pgschema:rollback\n`pgschema:rollback` add extra `schema` option to Laravel `migrate:rollback` command.\n```\nUsage:\n  pgschema:rollback [options]\n\nOptions:\n      --database[=DATABASE]  The database connection to use.\n      --force                Force the operation to run when in production.\n      --path[=PATH]          The path of migrations files to be executed.\n      --pretend              Dump the SQL queries that would be run.\n      --step[=STEP]          The number of migrations to be reverted.\n      --schema[=SCHEMA]      The database schema to use\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Rollback the last database migration\n```\n\n### pgschema:reset\n`pgschema:reset` add extra `schema` option to Laravel `migrate:reset` command.\n```\nUsage:\n  pgschema:reset [options]\n\nOptions:\n      --database[=DATABASE]  The database connection to use.\n      --force                Force the operation to run when in production.\n      --path[=PATH]          The path of migrations files to be executed.\n      --pretend              Dump the SQL queries that would be run.\n      --schema[=SCHEMA]      The database schema to use\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Rollback all database migrations\n```\n\n### pgschema:refresh\n`pgschema:refresh` add extra `schema` option to Laravel `migrate:refresh` command.\n```\nUsage:\n  pgschema:refresh [options]\n\nOptions:\n      --database[=DATABASE]  The database connection to use.\n      --force                Force the operation to run when in production.\n      --path[=PATH]          The path of migrations files to be executed.\n      --seed                 Indicates if the seed task should be re-run.\n      --seeder[=SEEDER]      The class name of the root seeder.\n      --step[=STEP]          The number of migrations to be reverted \u0026 re-run.\n      --schema[=SCHEMA]      The database schema to use\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Reset and re-run all migrations\n```\n\n\n### pgschema:seed\n`pgschema:seed` add extra `schema` option to Laravel `db:seed` command.\n```\nUsage:\n  pgschema:seed [options]\n\nOptions:\n      --class[=CLASS]        The class name of the root seeder [default: \"DatabaseSeeder\"]\n      --database[=DATABASE]  The database connection to seed\n      --schema[=SCHEMA]      The database schema to seed\n      --force                Force the operation to run when in production.\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Seed the database with records\n```\n\n\n### pgschema:create-schema\n`pgschema:create-schema` create `schema` for `database` .\n```\nUsage:\n  pgschema:create-schema [options] [--] \u003cschema\u003e\n\nArguments:\n  schema                     The database schema to create\n\nOptions:\n      --database[=DATABASE]  The database connection to use\n  -h, --help                 Display this help message\n  -q, --quiet                Do not output any message\n  -V, --version              Display this application version\n      --ansi                 Force ANSI output\n      --no-ansi              Disable ANSI output\n  -n, --no-interaction       Do not ask any interactive question\n      --env[=ENV]            The environment the command should run under\n  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n```\n\n## Facade Helper Functions\n### Create new Schema\n\n`PGSchema::create($schemaName, $databaseName)`\n\nif create is call without $databaseName argument, it using the default connection.\n\n\n### Drop Schema\n\n`PGSchema::drop($schemaName, $databaseName)`\n\nif drop is call without $databaseName argument, it using the default connection.\n\n\n### Switch Schema\n\n`PGSchema::schema($schemaName, $databaseName)`\n\nif schema is call without $schemaName argument, it switches to the public\nschema (default)\nif schema is call without $databaseName argument, it using the default connection.\n\n\n### Iterating Schemas\n\n`PGSchema::each(Closure $callback, $databaseName)`\n\nif each is call without $databaseName argument, it using the default connection.\n\n\n## License\nMIT: https://racklin.mit-license.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fracklin%2Fpgschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fracklin%2Fpgschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fracklin%2Fpgschema/lists"}