addColumns() public static method

Add columns to a table.
public static addColumns ( $tableName, array $columnDefinitions )
$columnDefinitions array
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('users', ['twitter_id' => ['string', 'length' => 255, 'nullable' => true]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('discussions', ['is_approved' => ['boolean', 'default' => 1]]);
コード例 #3
0
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('discussions', ['hide_time' => ['dateTime', 'nullable' => true], 'hide_user_id' => ['integer', 'unsigned' => true, 'nullable' => true]]);
コード例 #4
0
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('posts', ['ip_address' => ['string', 'length' => 45, 'nullable' => true]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('users', ['flags_read_time' => ['dateTime', 'nullable' => true]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('discussions', ['is_sticky' => ['boolean', 'default' => 0]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('posts', ['is_spam' => ['boolean', 'default' => 0]]);
コード例 #8
0
<?php

use Flarum\Database\Migration;
return Migration::addColumns('pages', ['is_html' => ['boolean', 'default' => 0]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('users_discussions', ['subscription' => ['enum', 'allowed' => ['follow', 'ignore'], 'nullable' => true]]);
<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
return Migration::addColumns('users', ['suspended_until' => ['dateTime', 'nullable' => true]]);