{"id":18273240,"url":"https://github.com/spacetab-io/rdb-php","last_synced_at":"2025-04-05T02:31:14.029Z","repository":{"id":57056365,"uuid":"255282281","full_name":"spacetab-io/rdb-php","owner":"spacetab-io","description":"Dead-simple async PHP migrations controlled from code.","archived":false,"fork":false,"pushed_at":"2020-05-19T07:53:05.000Z","size":84,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T21:19:12.589Z","etag":null,"topics":["amphp","async","cli","php","php74"],"latest_commit_sha":null,"homepage":null,"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/spacetab-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-13T09:22:13.000Z","updated_at":"2025-03-02T14:31:01.000Z","dependencies_parsed_at":"2022-08-24T14:52:55.155Z","dependency_job_id":null,"html_url":"https://github.com/spacetab-io/rdb-php","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Frdb-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Frdb-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Frdb-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Frdb-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacetab-io","download_url":"https://codeload.github.com/spacetab-io/rdb-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247279400,"owners_count":20912877,"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":["amphp","async","cli","php","php74"],"created_at":"2024-11-05T12:05:44.398Z","updated_at":"2025-04-05T02:31:13.252Z","avatar_url":"https://github.com/spacetab-io.png","language":"PHP","funding_links":[],"categories":["Database"],"sub_categories":[],"readme":"Async PHP migrations \u0026 seeds\n============================\n\n[![CircleCI](https://circleci.com/gh/spacetab-io/rdb-php/tree/master.svg?style=svg)](https://circleci.com/gh/spacetab-io/rdb-php/tree/master)\n[![codecov](https://codecov.io/gh/spacetab-io/rdb-php/branch/master/graph/badge.svg)](https://codecov.io/gh/spacetab-io/rdb-php)\n\nDead-simple PHP migrations controlled from code.\n\n## Features\n\n* Asynchronous migrations build with \u003cstrong\u003e\u003ca href=\"https://amphp.org/\"\u003eAmp\u003c/a\u003e\u003c/strong\u003e.\n* Developed to use from **code** and **cli**.\n* Developed to use any database with these tool. Currently supported official [Amp Postgres](https://github.com/amphp/postgres) \u0026 [MySQL](https://github.com/amphp/mysql) clients. \n* You can extend console commands to use tool with your custom config definitions instead of always use `--connect` flag.\n* You can use migrations/seeds files from anywhere and with any paths.\n\n## Installation\n\nInstall tool:\n\n```bash\ncomposer require spacetab-io/rdb\n```\n\nand install database client, like this:\n\n```bash\ncomposer require amphp/postgres\n```\n\n## Usage\n\n```php\nuse Spacetab\\Rdb\\Notifier\\StdoutNotifier;\nuse Spacetab\\Rdb\\Rdb;\nuse Spacetab\\Rdb\\Driver;\nuse Amp\\Postgres;\nuse Amp\\Postgres\\ConnectionConfig;\n\nAmp\\Loop::run(function () {\n    $config = ConnectionConfig::fromString('host=localhost user=root dbname=test');\n    /** @var Postgres\\Pool $pool */\n    $pool = Postgres\\pool($config);\n\n    $driver   = new Driver\\SQL\\Postgres($pool);\n    $rdb      = new Rdb($driver, new StdoutNotifier()); // Optional. By default notifications is muted.\n    $migrator = $rdb-\u003egetMigrator();\n\n    yield $migrator-\u003einstall();\n    yield $migrator-\u003emigrate();\n    yield $rdb-\u003egetSeeder()-\u003erun();\n});\n```\n\n## Usage from cli\n\n```bash\nvendor/bin/rdb list\n```\n\n```text\nRdb – dead-simple async PHP migrations controlled from code. (v1.0).\n\nUsage:\n  command [options] [arguments]\n\nOptions:\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  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nAvailable commands:\n  help             Displays help for a command\n  list             Lists commands\n make\n  make:migration   Create a new migration files\n  make:seed        Create a new seeder file\n migrate\n  migrate:down     [migrate:rollback] Rollback the last database migration\n  migrate:install  Create the migration repository\n  migrate:refresh  Reset and re-run all migrations\n  migrate:reset    Rollback all database migrations\n  migrate:status   Show the status of each migration\n  migrate:up       Run the database migrations\n seed\n  seed:run         Seed the database with records\n```\n\n## Depends\n\n* \\\u003e= PHP 7.4\n* Composer for install package\n\n## Tests\n\n* Unit `vendor/bin/phpunit --testsuite Unit`\n* Integration `vendor/bin/phpunit --testsuite Integration`. Accept ENV's: `PHPUNIT_RDB_PG_HOST`, `PHPUNIT_RDB_PG_PORT`, \n`PHPUNIT_RDB_PG_DBNAME`, `PHPUNIT_RDB_PG_USER`, `PHPUNIT_RDB_PG_PWD`\n\n## License\n\nThe MIT License\n\nCopyright © 2020 spacetab.io, Inc. https://spacetab.io\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Frdb-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacetab-io%2Frdb-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Frdb-php/lists"}