当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtil::add_fields方法代码示例

本文整理汇总了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')));
 }
开发者ID:roine,项目名称:wawaw,代码行数:12,代码来源:003_migrate_to_version_two.php

示例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')));
     }
 }
开发者ID:marietta-adachi,项目名称:website,代码行数:17,代码来源:006_auth_add_authactions.php

示例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);
 }
开发者ID:socialskeptic,项目名称:sainsburys,代码行数:19,代码来源:006_auth_add_authactions.php

示例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);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:22,代码来源:010_auth_fix_jointables.php

示例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();
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:36,代码来源:004_upgraderacks.php

示例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();
          }
         */
     }
 }
开发者ID:quickpacket,项目名称:noclayer,代码行数:24,代码来源:002_migrate02.php

示例7: up

 public function up()
 {
     \DBUtil::add_fields('tomorrow_list_stats', array('dialler' => array('constraint' => 255, 'type' => 'varchar')));
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:4,代码来源:042_add_dialler_to_tomorrow_list_stats.php

示例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')));
     }
 }
开发者ID:socialskeptic,项目名称:sainsburys,代码行数:38,代码来源:simple2orm.php

示例10: up

 public function up()
 {
     \DBUtil::add_fields('lessontimes', array('feedback' => array('type' => 'text')));
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:4,代码来源:026_add_feedback_to_lessontimes.php

示例11: up

 public function up()
 {
     \DBUtil::add_fields('players', array('is_core_player' => array('constraint' => 1, 'type' => 'int', 'default' => '0')));
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:4,代码来源:024_add_is_core_player_to_players.php

示例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;
     }
 }
开发者ID:nsbasicus,项目名称:warden,代码行数:14,代码来源:warden.php

示例13: up

 public function up()
 {
     \DBUtil::add_fields('contents', array('category' => array('constraint' => 1, 'type' => 'tinyint', 'null' => false, 'default' => '0')));
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:4,代码来源:065_add_category_to_contents.php

示例14: up

 public function up()
 {
     \DBUtil::add_fields('telesales_report_values', array('pack_out_commission' => array('constraint' => '7,2', 'type' => 'float')));
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:4,代码来源:057_add_pack_out_commission_to_telesales_report_values.php

示例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.')));
 }
开发者ID:hinashiki,项目名称:fuelphp-queue,代码行数:4,代码来源:002_add_priority_column_to_task_queues_table.php


注:本文中的DBUtil::add_fields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。