smartlaravel/safe-migrate
Composer 安装命令:
composer require smartlaravel/safe-migrate
包简介
Adds a prompt the the migrate command when connected to any non local database.
README 文档
README
This package extends the migration and seed commands. When you run
php artisan migrateand yourDB_HOSTsetting is not set to127.0.0.1orlocalhostyou will receive a safety confirmation asking you to confirm running the migration. This package was created out of an issue where I was connecting to different database connections to run commands remotely, I would forget to update the database connection and run a destructive migration on production. Luckily we backed our data up and no developers were harmed.
To install:
composer require smartlaravel/safe-migrate
To test:
You can set your hosts file to aim a random address to localhost, such as
12.23.34.45. Then set your Laravel .env file to useDB_HOST=12.23.34.45. Runphp artisan migrate,php artisan migrate:fresh, etc. and you should see a prompt warning you that your database connection is not local.
统计信息
- 总下载量: 152
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-24