{"id":23220849,"url":"https://github.com/deprecated-packages/doctrinemigrations","last_synced_at":"2025-10-07T05:23:08.303Z","repository":{"id":19761952,"uuid":"23019607","full_name":"deprecated-packages/DoctrineMigrations","owner":"deprecated-packages","description":"[DEPRECATED] Use Phinx instead ","archived":false,"fork":false,"pushed_at":"2017-06-01T10:28:53.000Z","size":170,"stargazers_count":22,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-02T13:10:27.147Z","etag":null,"topics":["database","deprecated","doctrine","migrations","phinx","php"],"latest_commit_sha":null,"homepage":"https://github.com/robmorgan/phinx","language":"PHP","has_issues":false,"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/deprecated-packages.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":"2014-08-16T14:30:14.000Z","updated_at":"2023-01-07T12:44:13.000Z","dependencies_parsed_at":"2022-09-01T03:22:25.572Z","dependency_job_id":null,"html_url":"https://github.com/deprecated-packages/DoctrineMigrations","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/deprecated-packages/DoctrineMigrations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FDoctrineMigrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FDoctrineMigrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FDoctrineMigrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FDoctrineMigrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deprecated-packages","download_url":"https://codeload.github.com/deprecated-packages/DoctrineMigrations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deprecated-packages%2FDoctrineMigrations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722757,"owners_count":26034463,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database","deprecated","doctrine","migrations","phinx","php"],"created_at":"2024-12-18T22:14:16.292Z","updated_at":"2025-10-07T05:23:08.278Z","avatar_url":"https://github.com/deprecated-packages.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doctrine Migrations\n\n[![Build Status](https://img.shields.io/travis/Zenify/DoctrineMigrations.svg?style=flat-square)](https://travis-ci.org/Zenify/DoctrineMigrations)\n[![Quality Score](https://img.shields.io/scrutinizer/g/Zenify/DoctrineMigrations.svg?style=flat-square)](https://scrutinizer-ci.com/g/Zenify/DoctrineMigrations)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/Zenify/DoctrineMigrations.svg?style=flat-square)](https://scrutinizer-ci.com/g/Zenify/DoctrineMigrations)\n[![Downloads this Month](https://img.shields.io/packagist/dt/zenify/doctrine-migrations.svg?style=flat-square)](https://packagist.org/packages/zenify/doctrine-migrations)\n[![Latest stable](https://img.shields.io/packagist/v/zenify/doctrine-migrations.svg?style=flat-square)](https://packagist.org/packages/zenify/doctrine-migrations)\n\nImplementation of [Doctrine\\Migrations](http://docs.doctrine-project.org/projects/doctrine-migrations/en/latest/) to Nette.\n\n\n## Install\n\n```sh\ncomposer require zenify/doctrine-migrations\n```\n\nRegister extensions in `config.neon`:\n\n```yaml\nextensions:\n\t- Arachne\\ContainerAdapter\\DI\\ContainerAdapterExtension\n\t- Arachne\\EventDispatcher\\DI\\EventDispatcherExtension\n\tmigrations: Zenify\\DoctrineMigrations\\DI\\MigrationsExtension\n\n\t# Kdyby\\Doctrine or another Doctrine integration\n\tdoctrine: Kdyby\\Doctrine\\DI\\OrmExtension\n```\n\n\n## Configuration\n\n`config.neon` with default values\n\n```yaml\nmigrations:\n\ttable: doctrine_migrations # database table for applied migrations\n\tcolumn: version # database column for applied migrations\n\tdirectory: %appDir%/../migrations # directory, where all migrations are stored\n\tnamespace: Migrations # namespace of migration classes\n\tcodingStandard: tabs # or \"spaces\", coding style for generated classes\n\tversionsOrganization: null # null, \"year\" or \"year_and_month\", organizes migrations to subdirectories\n```\n\n\n## Usage\n\nOpen your CLI and run command (based on `Kdyby\\Console` integration):\n\n```sh\nphp www/index.php\n```\n\nAnd then you should see all available commands:\n\n![CLI commands](cli-commands.png)\n\n\n\n### Migrate changes to database\n\nIf you want to migrate existing migration to your database, just run migrate commmand:\n \n```sh\nphp www/index.php migrations:migrate\n```\n\nIf you get lost, just use `-h` option for help:\n\n```sh\nphp www/index.php migrations:migrate -h\n```\n\n### Create new migration\n\nTo create new empty migration, just run:\n\n```sh\nphp www/index.php migrations:generate\n```\n\nA new empty migration will be created at your migrations directory. You can add your sql there then.\n\nMigration that would add new role `\"superadmin\"` to `user_role` table would look like this:\n\n```php\nnamespace Migrations;\n\nuse Doctrine\\DBAL\\Migrations\\AbstractMigration;\nuse Doctrine\\DBAL\\Schema\\Schema;\n\n/**\n * New role \"superadmin\" added.\n */\nfinal class Version20151015000003 extends AbstractMigration\n{\n\n\tpublic function up(Schema $schema)\n\t{\n\t\t$this-\u003eaddSql(\"INSERT INTO 'user_role' (id, value, name) VALUES (3, 'superadmin', 'Super Admin')\");\n\t}\n\t\n\n\tpublic function down(Schema $schema)\n\t{\n\t\t$this-\u003eaddSql(\"DELETE FROM 'user_role' WHERE ('id' = 3);\");\n\t}\n\n}\n```\n\nSimple as that!\n\n\nFor further use, please check [docs in Symfony bundle](http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html).\n\n\n## Features\n\n### Migrations organization\n\nIf you have over 100 migrations in one directory, it might get messy. Fortunately doctrine migrations can organize your migrations to directories by year or by year and month. You can configure it in your config.neon (see above).\n\n```\n/migrations/2015/11\n\t- VersionXXX.php\n/migrations/2015/12\n\t- VersionYYY.php\n/migrations/2016/01\n\t- VersionZZZ.php\n```\n\n\n### Injected migrations\n\nNote: this is not really best practise, so try to use it only if there is no other way.\n\n```php\nnamespace Migrations;\n\nfinal class Version20140801152432 extends AbstractMigration\n{\n\n\t/**\n\t * @inject\n\t * @var Doctrine\\ORM\\EntityManagerInterface\n\t */\n\tpublic $entityManager;\n\n\n\tpublic function up(Schema $schema)\n\t{\n\t\t// ...\n\t}\n\n\t// ...\n\n}\n```\n\n\n\n## Testing\n\n```sh\ncomposer check-cs\nvendor/bin/phpunit\n```\n\n\n## Contributing\n\nRules are simple:\n\n- new feature needs tests\n- all tests must pass\n- 1 feature per PR\n\nWe would be happy to merge your feature then!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fdoctrinemigrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeprecated-packages%2Fdoctrinemigrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeprecated-packages%2Fdoctrinemigrations/lists"}