
SwooleTable::create를 사용하여 테이블을 생성할 때, column을 지정할 수 있습니다.
column의 타입은 다음과 같습니다.
- int
- string
- float
- bool
- timestamp
- array
- object
- json
- blob
column의 타입을 지정할 때, 다음과 같은 예시를 사용할 수 있습니다.
#hostingforum.kr
php
$table = SwooleTable::create(array(
'id' => array('type' => 'int', 'auto_increment' => true),
'name' => array('type' => 'string', 'default' => 'default_name'),
'age' => array('type' => 'float', 'default' => 0.0),
));
default value를 지정할 수 있습니다. 위의 예시에서 'name' column의 default value는 'default_name'입니다.
또한, column의 타입을 지정할 때, 'default' 옵션을 사용하여 default value를 지정할 수 있습니다.
예를 들어, 'age' column의 default value는 0.0입니다.
default value를 지정할 때, 다음과 같은 예시를 사용할 수 있습니다.
#hostingforum.kr
php
$table = SwooleTable::create(array(
'id' => array('type' => 'int', 'auto_increment' => true),
'name' => array('type' => 'string'),
'age' => array('type' => 'float', 'default' => 0.0),
));
2025-04-07 09:59