"라라벨 migration 삭제"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
5번째 줄: 5번째 줄:


==예시: 실행되지 않은 migration==
==예시: 실행되지 않은 migration==
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:/var/www/laravel# php artisan migrate:status
root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
+------+------------------------------------------------+
14번째 줄: 14번째 줄:
| N    | 2016_05_15_090840_create_photos_table          |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
+------+------------------------------------------------+
</source>
</syntaxhighlight>
:→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
:→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:/var/www/laravel# cd database/migrations/
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# rm -f 2016_05_11_125910_create_channels_table.php
27번째 줄: 27번째 줄:
| N    | 2016_05_15_090840_create_photos_table          |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
+------+------------------------------------------------+
</source>
</syntaxhighlight>


==예시: 실행된 migration==
==예시: 실행된 migration==
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:/var/www/laravel# php artisan migrate:status
root@zetawiki:/var/www/laravel# php artisan migrate:status
+------+------------------------------------------------+
+------+------------------------------------------------+
39번째 줄: 39번째 줄:
| N    | 2016_05_15_090840_create_photos_table          |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
+------+------------------------------------------------+
</source>
</syntaxhighlight>
:→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
:→ 2016_05_11_125910_create_channels_table 를 삭제해 보자.
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:/var/www/laravel# php artisan migrate:rollback
root@zetawiki:/var/www/laravel# php artisan migrate:rollback
Rolled back: 2016_05_11_125910_create_channels_table
Rolled back: 2016_05_11_125910_create_channels_table
62번째 줄: 62번째 줄:
| N    | 2016_05_15_090840_create_photos_table          |
| N    | 2016_05_15_090840_create_photos_table          |
+------+------------------------------------------------+
+------+------------------------------------------------+
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:57 기준 최신판

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 }})
{{ comment.name }} {{ comment.created | snstime }}