라라벨 migration 삭제

1 개요[편집]

라라벨 migration 삭제
  • 실행되지 않은 migration은 migration 파일만 삭제하면 된다.
  • 실행된 migration은 rollback 후 migration 파일을 삭제하면 된다.

2 예시: 실행되지 않은 migration[편집]

root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
| Ran? | Migration                                      |
+------+------------------------------------------------+
| Y    | 2015_10_27_141258_create_tasks_table           |
| N    | 2016_05_11_125910_create_channels_table        |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
root@zetawiki:/var/www/laravel# cd database/migrations/
root@zetawiki:/var/www/laravel/database/migrations# rm -f 2016_05_11_125910_create_channels_table.php
root@zetawiki:/var/www/laravel/database/migrations# cd -
root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
| Ran? | Migration                                      |
+------+------------------------------------------------+
| Y    | 2015_10_27_141258_create_tasks_table           |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+

3 예시: 실행된 migration[편집]

root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
| Ran? | Migration                                      |
+------+------------------------------------------------+
| Y    | 2015_10_27_141258_create_tasks_table           |
| Y    | 2016_05_11_125910_create_channels_table        |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
root@zetawiki:/var/www/laravel# php artisan migrate:rollback
Rolled back: 2016_05_11_125910_create_channels_table
root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
| Ran? | Migration                                      |
+------+------------------------------------------------+
| Y    | 2015_10_27_141258_create_tasks_table           |
| N    | 2016_05_11_125910_create_channels_table        |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
root@zetawiki:/var/www/laravel# cd database/migrations/
root@zetawiki:/var/www/laravel/database/migrations# rm -f 2016_05_11_125910_create_channels_table.php
root@zetawiki:/var/www/laravel/database/migrations# cd -
root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
| Ran? | Migration                                      |
+------+------------------------------------------------+
| Y    | 2015_10_27_141258_create_tasks_table           |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+

4 같이 보기[편집]

5 참고[편집]

문서 댓글 ({{ doc_comments.length }})
{{ zf.userName }}
{{ comment.name }} {{ comment.created | snstime }}