일단 column을 변경하기 위해 migration파일을 생성한다.
$ php artisan make:migration modify_cnum
그리고 만들어진 파일에 아래와 같이 column정보를 변경한다
class ModifyCnum extends Migration
{
public function up()
{
Schema::table('business_1s', function ($table) {
$table->string('c_num', 90)->change();
});
}
public function down()
{
//
}
}
그리고 migrate를 실행한다
$ php artisan migrate
Migrating: 2021_05_11_162700_modify_cnum
RuntimeException
Changing columns for table "business_1s" requires Doctrine DBAL. Please install the doctrine/dbal package.
.
.
.
doctrine/dbal 패키지가 있어야 한다는 오류가 뜬다.
그래서 doctrine/dbal를 설치해 보았다.
$ composer require doctrine/dbal
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
The "https://repo.packagist.org/p/provider-2020-07%24633d2c720b5588573c06bb9aea38f1e99578a0bb4d5566107b5af4e688d8f287.json" file could not be downloaded: failed to open stream: 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다.
.
.
.
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
메모리가 부족하다는 오류가 떴다.
그래서 메모리 제한을 없애고 다시 설치를 해보았다.
$ COMPOSER_MEMORY_LIMIT=-1 composer require doctrine/dbal
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^3.1 for doctrine/dbal
./composer.json has been updated
.
.
.
Package manifest generated successfully.
70 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
COMPOSER_MEMORY_LIMIT=-1 composer require 명령어로 메모리 제한을 없애고 설치하니 잘 설치 된다.
이제 다시 migrate를 해보자.
$ php artisan migrate
Migrating: 2021_05_11_162700_modify_cnum
Error
Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
.
.
.
doctrine/dbal를 설치 했는데 찾을 수 없다는 오류가 뜬다?
구글링 해보니 2.* 버전을 설치하면 된다고 한다.(위 설치는 그냥 설치해서 3.1버전이 설치 됐다)
$ COMPOSER_MEMORY_LIMIT=-1 composer require doctrine/dbal:2.*
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
./composer.json has been updated
Loading composer repositories with package information
Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downgrading doctrine/dbal (3.1.0 => 2.13.1): Downloading (100%)
.
.
.
Package manifest generated successfully.
70 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
2.* 버전으로 다시 설치했다.
위를 보면, 3.1버전에서 2.13버전으로 바뀌는걸 알 수 있다.
자 이제 다시 migrate를 해보자
$ php artisan migrate
Migrating: 2021_05_11_162700_modify_cnum
Migrated: 2021_05_11_162700_modify_cnum (0.51 seconds)
드디어 잘 migrate가 됐다.