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


PHP DBUtil::modify_fields方法代码示例

本文整理汇总了PHP中DBUtil::modify_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::modify_fields方法的具体用法?PHP DBUtil::modify_fields怎么用?PHP DBUtil::modify_fields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtil的用法示例。


在下文中一共展示了DBUtil::modify_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: down

 function down()
 {
     // 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');
         // modify the filter field to add the 'remove' filter
         \DBUtil::modify_fields($table . '_roles', array('filter' => array('type' => 'enum', 'constraint' => "'', 'A', 'D'", 'default' => '')));
     }
 }
开发者ID:cloudetm,项目名称:development,代码行数:14,代码来源:007_auth_add_permissionsfilter.php

示例3: run

 public static function run()
 {
     try {
         $users = \DB::select_array(['id', 'username'])->from('users')->execute();
         \DB::start_transaction();
         foreach ($users as $user) {
             \DB::update('auctions')->value('won_user', $user['id'])->where('won_user', '=', $user['username'])->execute();
         }
         \DB::commit_transaction();
         \DBUtil::modify_fields('auctions', ['won_user' => ['constraint' => 11, 'type' => 'int', 'name' => 'user_id']]);
     } catch (Exception $e) {
         \DB::rollback_transaction();
     }
 }
开发者ID:notfoundsam,项目名称:yahooauc,代码行数:14,代码来源:sql.php

示例4: down

 function down()
 {
     // 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($connection = \Config::get('ormauth.db_connection', null));
         // modify the filter field to add the 'remove' filter
         \DB::update($table . '_roles')->set(array('filter' => 'D'))->where('filter', '=', 'R')->execute($connection);
         \DBUtil::modify_fields($table . '_roles', array('filter' => array('type' => 'enum', 'constraint' => "'', 'A', 'D'", 'default' => '')));
     }
     // reset any DBUtil connection set
     \DBUtil::set_connection(null);
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:17,代码来源:007_auth_add_permissionsfilter.php

示例5: down

 public function down()
 {
     \DBUtil::modify_fields('creatures', array('name' => array('name' => 'creature', 'type' => 'varchar', 'constraint' => 255)));
 }
开发者ID:nobuhiko,项目名称:mylogbook,代码行数:4,代码来源:006_rename_field_creature_to_name_in_creatures.php

示例6: 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

示例7: down

 public function down()
 {
     \DBUtil::modify_fields('users', array('contact_num' => array('name' => 'contact_number', 'type' => 'varchar', 'constraint' => 20)));
 }
开发者ID:xXLXx,项目名称:ddc,代码行数:4,代码来源:007_alter_field_contact_number_to_contact_num_in_users.php

示例8: down

 public function down()
 {
     \DBUtil::modify_fields('users', array('profile_field' => array('name' => 'profile_fields', 'type' => 'text', 'null' => true)));
 }
开发者ID:xXLXx,项目名称:ddc,代码行数:4,代码来源:008_alter_field_profile_fields_to_profile_field_in_users.php

示例9: down

 public function down()
 {
     \DBUtil::modify_fields('users', array('charge_html' => array('type' => 'tinyint', 'constraint' => 1)));
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:4,代码来源:055_edit_change_html_from_users.php

示例10: down

 public function down()
 {
     \DBUtil::modify_fields('authentications', array('secret' => array('constraint' => 255, 'type' => 'varchar', 'null' => false)));
 }
开发者ID:rainyman2012,项目名称:fuel-ninjauth,代码行数:4,代码来源:003_Allow_null_secret.php

示例11: down

 public function down()
 {
     \DBUtil::modify_fields('contacts', array('first_name' => array('type' => 'varchar', 'constraint' => 255), 'last_name' => array('type' => 'varchar', 'constraint' => 255)));
 }
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:4,代码来源:023_modify_contacts.php

示例12: down

 public function down()
 {
     \DBUtil::modify_fields('tests', array('biography' => array('name' => 'bio', 'type' => 'text')));
 }
开发者ID:amemiya0222,项目名称:soccer_antena,代码行数:4,代码来源:003_rename_field_bio_to_biography_in_tests.php

示例13: down

 public function down()
 {
     \DBUtil::rename_table('seller_callbacks', 'seller_events');
     \DBUtil::modify_fields('seller_events', array('url' => array('name' => 'callback', 'type' => 'varchar', 'constraint' => 255)));
 }
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:5,代码来源:022_rename_seller_events.php

示例14: down

 public function down()
 {
     \DBUtil::modify_fields('books', array('book_url' => array('name' => 'file_url', 'type' => 'varchar', 'constraint' => 255, 'null' => true)));
 }
开发者ID:xXLXx,项目名称:ddc,代码行数:4,代码来源:012_alter_field_file_url_to_book_url_in_books.php

示例15: create_tables

 public function create_tables()
 {
     if (file_exists(APPPATH . 'config/production/db.php') == true) {
         Log::error('shit worked!');
     }
     // DBUtil::set_connection(null);
     if (DBUtil::table_exists('urls')) {
         if (DBUtil::field_exists('urls', array('time'))) {
             // Upgrade Me
             try {
                 DBUtil::rename_table('urls', 'v2_urls');
                 DBUtil::rename_table('stats', 'v2_stats');
                 DBUtil::rename_table('settings', 'v2_settings');
             } catch (\Database_Exception $e) {
                 Log::error($e);
             }
             Controller_Install::create_tables();
         } else {
             // Already Installed
         }
     } else {
         $oil_path = str_replace('public/', '', DOCROOT);
         try {
             @Migrate::current('default', 'app');
             @Migrate::current('auth', 'package');
         } catch (\Database_exception $e) {
             Debug::Dump('PLEASE REVISIT THIS /install (DONT RELOAD) THAT SHOULD INSTALL THE SCRIPT FOR YOU IF NOT THEN: Access has been denied for the database user , go to fuel/app/config/production/db.php , and edit your username and password!');
             die;
         }
         try {
             \DBUtil::create_index('urls', 'short_url');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('urls', 'user_id');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('urls', array('id', 'short_url'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('urls', array('id', 'user_id'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('urls', array('id', 'short_url', 'user_id'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats', 'url_id');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats', 'country');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats', array('id', 'url_id'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats_countries', 'start_ip');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats_countries', 'end_ip');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats_countries', 'country');
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats_countries', array('start_ip', 'end_ip'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::create_index('url_stats_countries', array('start_ip', 'end_ip', 'country'));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
         try {
             \DBUtil::modify_fields('urls', array('url' => array('constraint' => 255, 'type' => 'varchar')));
         } catch (\Database_exception $e) {
             Log::error($e);
         }
     }
//.........这里部分代码省略.........
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:101,代码来源:install.php


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