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


PHP Manager::schema方法代码示例

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


在下文中一共展示了Manager::schema方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TableExists

 /**
  * Returns true if the specified table exists in the database.
  *
  * @param $table
  *
  * @return bool
  */
 public function TableExists($table)
 {
     if ($this->capsule->schema()->hasTable($table)) {
         return true;
     }
     return false;
 }
开发者ID:CrashfortStudios,项目名称:MusicCommerce,代码行数:14,代码来源:Manager.php

示例2: createSchema

 /**
  * Create Schema
  *
  * @return AdapterInterface
  */
 public function createSchema()
 {
     /* @var \Illuminate\Database\Schema\Blueprint $table */
     $this->adapter->schema()->create($this->tableName, function ($table) {
         $table->string('version');
     });
 }
开发者ID:edisonnica,项目名称:phpmig,代码行数:12,代码来源:Database.php

示例3: setupBeforeClass

 public static function setupBeforeClass()
 {
     $db = new DB();
     $db->addConnection(['driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '']);
     $db->setAsGlobal();
     $db->bootEloquent();
     $db->schema()->create('voucher_campaigns', function ($table) {
         $table->increments('id');
         $table->timestamps();
         $table->string('name');
         $table->string('brand');
         $table->string('urn')->unique();
         $table->integer('expiry_limit')->default('14');
         $table->boolean('is_active')->default('1');
     });
     $db->schema()->create('voucher_entries', function ($table) {
         $table->increments('id');
         $table->timestamps();
         $table->string('hash')->unique();
         $table->integer('campaign_id');
         $table->boolean('is_redeemed')->default('0');
         $table->datetime('redeemed_at')->default('0000-00-00 00:00:00');
         $table->boolean('is_expired')->default('0');
         $table->datetime('expired_at')->default('0000-00-00 00:00:00');
         $table->boolean('is_valid')->default('1');
     });
     parent::setupBeforeClass();
     static::$fm->seed(5, 'Fastwebmedia\\LaravelVouchering\\Models\\Campaign');
     static::$fm->seed(5, 'Fastwebmedia\\LaravelVouchering\\Models\\Voucher');
 }
开发者ID:fastwebmedia,项目名称:laravel-vouchering,代码行数:30,代码来源:VoucherFactoryTest.php

示例4: init

 public function init()
 {
     $this->capsule = new Capsule();
     $this->capsule->addConnection(['driver' => 'mysql', 'host' => DB_HOST, 'port' => DB_PORT, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci']);
     $this->capsule->bootEloquent();
     $this->capsule->setAsGlobal();
     $this->schema = $this->capsule->schema();
 }
开发者ID:joppuyo,项目名称:EloquentMigrationsUsingPhinx,代码行数:8,代码来源:Migration.php

示例5: init

 /**
  * Init the migration
  */
 public function init()
 {
     //Get the Container
     $container = $this->getContainer();
     //Get Eloquent capsule
     $this->capsule = $container['db'];
     //Get schema builder instance
     $this->schema = $this->capsule->schema();
 }
开发者ID:AshniSukhoo,项目名称:UOM_connect,代码行数:12,代码来源:20160229181425_CreateStudentCourseFacultyTable.php

示例6: createMigrationHistoryTable

 /**
  * Creates the migration history table.
  */
 protected function createMigrationHistoryTable()
 {
     $tableName = $this->migrationTable;
     $this->stdout("Creating migration history table \"{$tableName}\"...", Console::FG_YELLOW);
     $this->db->schema()->create($this->migrationTable, function (Blueprint $table) {
         $table->string('version', 180);
         $table->primary('version');
         $table->integer('apply_time');
     });
     $this->addMigrationHistory(self::BASE_MIGRATION);
     $this->stdout("Done.\n", Console::FG_GREEN);
 }
开发者ID:lordthorzonus,项目名称:yii2-eloquent,代码行数:15,代码来源:MigrateController.php

示例7: createAndSeedOrdersTable

 /**
  * Creates and seeds the order table.
  */
 protected function createAndSeedOrdersTable()
 {
     /*
      * @var $db Manager
      */
     $this->db = Yii::$app->db;
     $this->db->schema()->create('order', function ($table) {
         $table->increments('id');
         $table->string('name')->unique();
         $table->timestamps();
     });
     Order::create(['name' => 'Test address']);
     Order::create(['name' => 'Another test Address']);
 }
开发者ID:lordthorzonus,项目名称:yii2-eloquent,代码行数:17,代码来源:Yii2EloquentTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $this->mockWebApplication();
     $this->db = Yii::$app->db;
     $this->db->schema()->dropIfExists('order');
     $this->db->schema()->create('order', function (Blueprint $table) {
         $table->increments('id');
         $table->string('address');
         $table->timestamps();
     });
     $this->unloadFixtures();
     $this->loadFixtures();
 }
开发者ID:lordthorzonus,项目名称:yii2-eloquent,代码行数:14,代码来源:EloquentFixtureTest.php

示例9: migrateTables

 protected function migrateTables()
 {
     DB::schema()->create('posts', function ($table) {
         $table->increments('id');
         $table->integer('author_id')->unsigned();
         $table->string('title');
         $table->timestamps();
     });
     DB::schema()->create('comments', function ($table) {
         $table->increments('id');
         $table->integer('post_id')->unsigned();
         $table->string('body');
         $table->timestamps();
     });
     DB::schema()->create('people', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->timestamps();
     });
     DB::schema()->create('messages', function ($table) {
         $table->increments('id');
         $table->integer('sender_id')->unsigned();
         $table->integer('receiver_id')->unsigned();
         $table->string('contents');
         $table->timestamps();
     });
 }
开发者ID:Rotron,项目名称:laravel5-shop,代码行数:27,代码来源:FactoryTest.php

示例10: runMigrations

 /**
  * command migrate
  */
 private function runMigrations()
 {
     $files = glob($this->getMigrationPath() . '/*.php');
     if (!Capsule::schema()->hasTable('migrations')) {
         Capsule::schema()->create('migrations', function ($table) {
             $table->string('migration');
             $table->integer('batch');
         });
     }
     $migrations = Migration::all();
     foreach ($migrations as $migration) {
         $filename = $this->getMigrationPath() . '/' . $migration->migration . '.php';
         if (in_array($filename, $files)) {
             $key = array_keys($files, $filename);
             unset($files[$key[0]]);
         }
     }
     $batch = Migration::all()->max('batch') + 1;
     foreach ($files as $file) {
         require_once $file;
         $filename = basename($file, '.php');
         $class = substr($filename, 18);
         $migration = new $class();
         $migration->up();
         Migration::create(array('migration' => $filename, 'batch' => $batch));
         $this->line("<success>File \"{$filename}.php\" processed</success>\n");
     }
 }
开发者ID:wu3rstle,项目名称:slimtwig,代码行数:31,代码来源:Db.php

示例11: migrateTables

 /**
  * Migrates the tables required for testing.
  */
 protected function migrateTables()
 {
     DB::schema()->create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email');
         $table->timestamps();
     });
     DB::schema()->create('posts', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->text('body');
         $table->unsignedInteger('user_id')->index();
         $table->timestamps();
     });
     DB::schema()->create('tags', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->timestamps();
     });
     DB::schema()->create('post_tag', function (Blueprint $table) {
         $table->unsignedInteger('tag_id')->index();
         $table->unsignedInteger('post_id')->index();
     });
     DB::schema()->create('categories', function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->text('description')->nullable();
         $table->timestamps();
     });
 }
开发者ID:logaretm,项目名称:transformers,代码行数:34,代码来源:TestCase.php

示例12: createTables

 public function createTables()
 {
     Capsule::schema()->create('routes', function ($table) {
         $table->increments('id');
         $table->string('name')->nullable();
     });
     Capsule::schema()->create('methods', function ($table) {
         $table->increments('id');
         $table->string('tags');
         $table->enum('method', ['GET', 'POST', 'PUT', 'DELETE']);
         $table->text('description')->nullable();
         $table->integer('route_id')->unsigned()->index();
         $table->foreign('route_id')->references('id')->on('routes')->onDelete('cascade');
     });
     Capsule::schema()->create('parameters', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->enum('in', ['formData', 'path']);
         $table->text('description')->nullable();
         $table->boolean('required');
         $table->enum('type', ['string', 'file']);
         $table->integer('method_id')->unsigned()->index();
         $table->foreign('method_id')->references('id')->on('methods')->onDelete('cascade');
     });
 }
开发者ID:ritesrnjn,项目名称:api_docs,代码行数:25,代码来源:migrate.php

示例13: createTables

 protected function createTables()
 {
     Manager::schema()->create('conv_users', function ($table) {
         $table->integer('conv_id')->nullable();
         $table->integer('user_id')->nullable();
         $table->primary(array('conv_id', 'user_id'));
     });
     Manager::schema()->create('conversations', function ($table) {
         $table->increments('id');
         $table->softDeletes();
         $table->timestamps();
     });
     Manager::schema()->create('messages', function ($table) {
         $table->increments('id');
         $table->integer('sender_id');
         $table->integer('conv_id');
         $table->text('content');
         $table->timestamps();
         $table->index('sender_id');
         $table->index('conv_id');
     });
     Manager::schema()->create('messages_status', function ($table) {
         $table->increments('id');
         $table->integer('user_id');
         $table->integer('msg_id');
         $table->boolean('self');
         $table->integer('status');
         $table->index('msg_id');
     });
 }
开发者ID:pnagaraju25,项目名称:tbmsg,代码行数:30,代码来源:TestCaseDb.php

示例14: migration

 /**
  * To Perform migration to ensure the table and its properties
  * are up-to-date
  *
  */
 public static function migration()
 {
     $tables = Migration::tables();
     // Simple Filters.
     if (!isset($tables)) {
         return false;
     }
     foreach ($tables as $key => $value) {
         if (empty($value) || is_null($value) || !isset($value)) {
             continue;
         }
         loop:
         if (Capsule::Schema()->hasTable($key)) {
             foreach ($value as $column => $datatype) {
                 if (!Capsule::Schema()->hasColumn($key, $column)) {
                     //Assign the Name and Datatype for temporary access
                     self::$columns['name'] = $column;
                     self::$columns['datatype'] = $datatype;
                     Capsule::Schema()->table($key, function ($table) {
                         $column = self::$columns['name'];
                         $datatype = self::$columns['datatype'];
                         $table->{$datatype}($column)->after('id');
                     });
                 }
             }
         } else {
             Capsule::schema()->create($key, function ($table) {
                 $table->increments('id');
                 $table->timestamps();
             });
             goto loop;
         }
     }
 }
开发者ID:shankarbala33,项目名称:php_migration,代码行数:39,代码来源:init.php

示例15: migrateTables

 protected function migrateTables()
 {
     DB::schema()->create('models', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->timestamps();
     });
 }
开发者ID:joeriaben,项目名称:bladecache,代码行数:8,代码来源:TestCase.php


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