Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fadilxcoder/phinx
Phinx database migrations
https://github.com/fadilxcoder/phinx
database php poc
Last synced: 5 days ago
JSON representation
Phinx database migrations
- Host: GitHub
- URL: https://github.com/fadilxcoder/phinx
- Owner: fadilxcoder
- Created: 2021-11-14T09:38:02.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-04T18:55:02.000Z (12 months ago)
- Last Synced: 2024-04-15T03:46:16.189Z (7 months ago)
- Topics: database, php, poc
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHINX
- https://phinx.org/ (phinx)
- https://book.cakephp.org/phinx/0/en/index.html (Phinx Documentation)
- https://book.cakephp.org/phinx/0/en/migrations.html (Writing Migrations)
- https://book.cakephp.org/phinx/0/en/seeding.html (Database Seeding)
- https://book.cakephp.org/phinx/0/en/commands.html (Commands)## Notes
- Install using cmd : `composer require robmorgan/phinx`
- Create directory in project files : `db/migrations` & `db/seeds`
- Initialization : `vendor/bin/phinx init`
- Database configs located in `phinx.php`
- Creating a migration : `vendor/bin/phinx create UserMigration` - will create file *YYYYMMDDHHMMSS_user_migration.php* in `db/migrations`
- Add codes in `change()` method of the newly created file
- Executing a migration : `vendor/bin/phinx migrate -e development` , in **development** environment
- Creating a table seeder : `vendor/bin/phinx seed:create UserSeeder` - will create file in `db/seeds`
- Add codes in `run()` method in **UserSeeder** class
- Execute the seeder : `vendor/bin/phinx seed:run`
- Print the queries to standard output without executing them `vendor/bin/phinx rollback --dry-run`
- `vendor/bin/phinx status` - list of all migrations
- Adding a column to table through migration - `vendor/bin/phinx migrate -t 20211114101311XXXXXXXX`
- Executing specific seeder : `vendor/bin/phinx seed:run -s UserCompanySeeder`
## Usage
- `vendor/bin/phinx seed:run`
- `vendor/bin/phinx seed:run -s UserCompanySeeder`
- `vendor/bin/phinx migrate -t 20211114083508` & `vendor/bin/phinx seed:run -s UserSeeder`