本文整理汇总了PHP中DBUtil::add_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::add_fields方法的具体用法?PHP DBUtil::add_fields怎么用?PHP DBUtil::add_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::add_fields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: down
public function down()
{
// load the sentry config file
\Config::load('sentry', true);
// add group table columns level, is_admin and parent
\DBUtil::add_fields(\Config::get('sentry.table.groups'), array('level' => array('constraint' => 11, 'type' => 'int'), 'is_admin' => array('constraint' => 1, 'type' => 'tinyint'), 'parent' => array('constraint' => 11, 'type' => 'int')));
// remove group table column permission
\DBUtil::drop_fields(\Config::get('sentry.table.groups'), array('permissions'));
// remove user table column permission
\DBUtil::drop_fields(\Config::get('sentry.table.users'), array('permissions'));
\DBUtil::modify_fields(\Config::get('sentry.table.users'), array('password' => array('constraint' => 81, 'type' => 'varchar'), 'temp_password' => array('constraint' => 81, 'type' => 'varchar'), 'password_reset_hash' => array('constraint' => 81, 'type' => 'varchar'), 'remember_me' => array('constraint' => 81, 'type' => 'varchar'), 'activation_hash' => array('constraint' => 81, 'type' => 'varchar')));
}
示例2: up
function up()
{
// get the driver used
\Config::load('auth', true);
$drivers = \Config::get('auth.driver', array());
is_array($drivers) or $drivers = array($drivers);
if (in_array('Ormauth', $drivers)) {
// get the tablename
\Config::load('ormauth', true);
$table = \Config::get('ormauth.table_name', 'users');
// add the actions field to the permission and permission through tables
\DBUtil::add_fields($table . '_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'description')));
\DBUtil::add_fields($table . '_user_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
\DBUtil::add_fields($table . '_group_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
\DBUtil::add_fields($table . '_role_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
}
}
示例3: up
function up()
{
// get the drivers defined
$drivers = normalize_driver_types();
if (in_array('Ormauth', $drivers)) {
// get the tablename
\Config::load('ormauth', true);
$table = \Config::get('ormauth.table_name', 'users');
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('ormauth.db_connection', null));
// add the actions field to the permission and permission through tables
\DBUtil::add_fields($table . '_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'description')));
\DBUtil::add_fields($table . '_user_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
\DBUtil::add_fields($table . '_group_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
\DBUtil::add_fields($table . '_role_permissions', array('actions' => array('type' => 'text', 'null' => true, 'after' => 'perms_id')));
}
// reset any DBUtil connection set
\DBUtil::set_connection(null);
}
示例4: up
function up()
{
// get the driver used
\Config::load('auth', true);
$drivers = \Config::get('auth.driver', array());
is_array($drivers) or $drivers = array($drivers);
if (in_array('Ormauth', $drivers)) {
// get the tablename
\Config::load('ormauth', true);
$basetable = \Config::get('ormauth.table_name', 'users');
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('simpleauth.db_connection', null));
\DBUtil::drop_index($basetable . '_user_permissions', 'primary');
\DBUtil::add_fields($basetable . '_user_permissions', array('id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true, 'primary_key' => true, 'first' => true)));
\DBUtil::drop_index($basetable . '_group_permissions', 'primary');
\DBUtil::add_fields($basetable . '_group_permissions', array('id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true, 'primary_key' => true, 'first' => true)));
\DBUtil::drop_index($basetable . '_role_permissions', 'primary');
\DBUtil::add_fields($basetable . '_role_permissions', array('id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true, 'primary_key' => true, 'first' => true)));
}
// reset any DBUtil connection set
\DBUtil::set_connection(null);
}
示例5: up
public function up()
{
$user = \DB::select('id')->from('users')->limit(1)->execute()->current();
/* * ********************************************************************************************
update rack position
* ********************************************************************************************* */
$israck = \DBUtil::checkIfExist('rack');
if ($israck) {
if (!\DBUtil::field_exists('rack', array('position'))) {
// Fields don't exist
\DBUtil::add_fields('rack', array('position' => array('constraint' => 11, 'type' => 'int')));
}
}
/* * ********************************************************************************************
add room height to settings
* ********************************************************************************************* */
$settings = \DB::select('value')->from('settings')->where('name', 'room_height')->as_object()->execute();
if (!isset($settings[0])) {
// insert default building
list($set_id, $rows_affected) = \DB::insert('settings')->columns(array('id', 'name', 'value', 'meta_update_user'))->values(array('', 'room_height', '2500', $user['id']))->execute();
}
$settings = \DB::select('value')->from('settings')->where('name', 'tutorials')->as_object()->execute();
if (!isset($settings[0])) {
// insert default building
list($set_id, $rows_affected) = \DB::insert('settings')->columns(array('id', 'name', 'value', 'meta_update_user'))->values(array('', 'tutorials', '0', $user['id']))->execute();
}
$settings = \DB::select('value')->from('settings')->where('name', 'background')->as_object()->execute();
if (!isset($settings[0])) {
// insert default building
list($set_id, $rows_affected) = \DB::insert('settings')->columns(array('id', 'name', 'value', 'meta_update_user'))->values(array('', 'background', '2', $user['id']))->execute();
}
/* * ********************************************************************************************
fix zero position for racks into rooms
* ********************************************************************************************* */
$this->__update_rack_position();
}
示例6: up
function up()
{
//check for address field as integer
if (!\DBUtil::field_exists('network_ip_ports', array('addrint'))) {
//\Fuel\Core\Module::load('basic');
//add field
\DBUtil::add_fields('network_ip_ports', array('addrint' => array('type' => 'double')));
$ports = \DB::select('id', 'ipv4')->from('network_ip_ports')->as_object()->execute();
foreach ($ports as $port) {
$result = \DB::update('network_ip_ports')->value("addrint", $this->IPv4_dotquadA_to_intA($port->ipv4))->where('id', '=', $port->id)->execute();
}
/*
$ips = \Basic\Model_Network_Ip::find('all');
foreach($ips as $ip){
$ip->addrint=$this->IPv4_dotquadA_to_intA($ip->ipv4);
$ip->save();
}
*/
}
}
示例7: up
public function up()
{
\DBUtil::add_fields('tomorrow_list_stats', array('dialler' => array('constraint' => 255, 'type' => 'varchar')));
}
示例8: up
public function up()
{
\DBUtil::add_fields('data_supplier_campaign_lists_duplicates', array('lead_id' => array('constraint' => 11, 'type' => 'int')));
}
开发者ID:ClixLtd,项目名称:pccupload,代码行数:4,代码来源:040_add_lead_id_to_data_supplier_campaign_lists_duplicates.php
示例9: usertable
protected static function usertable()
{
if (!\DBUtil::table_exists(static::$data['ormauth_table'])) {
if (!\DBUtil::table_exists(static::$data['simpleauth_table'])) {
// table users
\DBUtil::create_table(static::$data['ormauth_table'], array('id' => array('type' => 'int', 'constraint' => 11, 'auto_increment' => true), 'username' => array('type' => 'varchar', 'constraint' => 50), 'password' => array('type' => 'varchar', 'constraint' => 255), 'group_id' => array('type' => 'int', 'constraint' => 11, 'default' => 1), 'email' => array('type' => 'varchar', 'constraint' => 255), 'last_login' => array('type' => 'varchar', 'constraint' => 25), 'previous_login' => array('type' => 'varchar', 'constraint' => 25, 'default' => 0), 'login_hash' => array('type' => 'varchar', 'constraint' => 255), 'user_id' => array('type' => 'int', 'constraint' => 11, 'default' => 0), 'created_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0), 'updated_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0)), array('id'));
// add a unique index on username and email
\DBUtil::create_index(static::$data['ormauth_table'], array('username', 'email'), 'username', 'UNIQUE');
} else {
\DBUtil::rename_table(static::$data['simpleauth_table'], static::$data['ormauth_table']);
}
}
// run a check on required fields, and deal with missing ones. we might be migrating from simpleauth
if (\DBUtil::field_exists(static::$data['ormauth_table'], 'group')) {
\DBUtil::modify_fields(static::$data['ormauth_table'], array('group' => array('name' => 'group_id', 'type' => 'int', 'constraint' => 11)));
}
if (!\DBUtil::field_exists(static::$data['ormauth_table'], 'group_id')) {
\DBUtil::add_fields(static::$data['ormauth_table'], array('group_id' => array('type' => 'int', 'constraint' => 11, 'default' => 1, 'after' => 'password')));
}
if (!\DBUtil::field_exists(static::$data['ormauth_table'], 'previous_login')) {
\DBUtil::add_fields(static::$data['ormauth_table'], array('previous_login' => array('type' => 'varchar', 'constraint' => 25, 'default' => 0, 'after' => 'last_login')));
}
if (!\DBUtil::field_exists(static::$data['ormauth_table'], 'user_id')) {
\DBUtil::add_fields(static::$data['ormauth_table'], array('user_id' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'login_hash')));
}
if (\DBUtil::field_exists(static::$data['ormauth_table'], 'created')) {
\DBUtil::modify_fields(static::$data['ormauth_table'], array('created' => array('name' => 'created_at', 'type' => 'int', 'constraint' => 11)));
}
if (!\DBUtil::field_exists(static::$data['ormauth_table'], 'created_at')) {
\DBUtil::add_fields(static::$data['ormauth_table'], array('created_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'user_id')));
}
if (\DBUtil::field_exists(static::$data['ormauth_table'], 'updated')) {
\DBUtil::modify_fields(static::$data['ormauth_table'], array('updated' => array('name' => 'updated_at', 'type' => 'int', 'constraint' => 11)));
}
if (!\DBUtil::field_exists(static::$data['ormauth_table'], 'updated_at')) {
\DBUtil::add_fields(static::$data['ormauth_table'], array('updated_at' => array('type' => 'int', 'constraint' => 11, 'default' => 0, 'after' => 'created_at')));
}
}
示例10: up
public function up()
{
\DBUtil::add_fields('lessontimes', array('feedback' => array('type' => 'text')));
}
示例11: up
public function up()
{
\DBUtil::add_fields('players', array('is_core_player' => array('constraint' => 1, 'type' => 'int', 'default' => '0')));
}
示例12: _alter_or_return_fields
private function _alter_or_return_fields($name, array $fields, $new)
{
if (!$new) {
if (\Cli::option('R', false) || \Cli::option('remove', false)) {
\DBUtil::drop_fields('users', array_keys($fields));
\Cli::write(\Cli::color("{$name} fields removed successfully", 'green'));
} else {
\DBUtil::add_fields('users', $fields);
\Cli::write(\Cli::color("{$name} fields added successfully", 'green'));
}
} else {
return $fields;
}
}
示例13: up
public function up()
{
\DBUtil::add_fields('contents', array('category' => array('constraint' => 1, 'type' => 'tinyint', 'null' => false, 'default' => '0')));
}
示例14: up
public function up()
{
\DBUtil::add_fields('telesales_report_values', array('pack_out_commission' => array('constraint' => '7,2', 'type' => 'float')));
}
示例15: up
public function up()
{
\DBUtil::add_fields('task_queues', array('priority' => array('type' => 'tinyint', 'default' => 0, 'unsigned' => true, 'comment' => 'task\'s priority. 0 has top priority. you can setting default priority by config.')));
}