本文整理汇总了PHP中Illuminate\Database\Schema\Builder::hasTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::hasTable方法的具体用法?PHP Builder::hasTable怎么用?PHP Builder::hasTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Schema\Builder
的用法示例。
在下文中一共展示了Builder::hasTable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runTestMigrations
/**
* Run migrations for tables only used for testing purposes.
*
* @return void
*/
protected function runTestMigrations()
{
include_once __DIR__ . '/../resources/migrations/create_adjustments_table.php.stub';
(new \CreateAdjustmentsTable())->up();
if (!$this->schema->hasTable('fruits')) {
$this->schema->create('fruits', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('price');
});
}
}
示例2: dropInstance
/**
* instance 내 모든 데이터 삭제
*
* @param string $instanceId instance identifier
* @return void
*/
public function dropInstance($instanceId)
{
if ($this->isEnable($instanceId) === true) {
if ($this->schema->hasTable($this->getTable($instanceId)) === true) {
$this->schema->drop($this->getTable($instanceId));
}
}
$this->repo->dropInstance($instanceId);
}
示例3: dropColumn
/**
* Drop a column.
*
* @param $table
* @param FieldType $type
*/
public function dropColumn($table, FieldType $type)
{
$schema = $type->getSchema();
if (!$this->schema->hasTable($table)) {
return;
}
$this->schema->table($table, function (Blueprint $table) use($schema) {
$schema->dropColumn($table);
});
}
示例4: cleanup
/**
* Clean up abandoned streams.
*/
public function cleanup()
{
/* @var StreamInterface $stream */
foreach ($this->model->all() as $stream) {
if (!$this->schema->hasTable($stream->getEntryTableName())) {
$this->delete($stream);
}
}
$translations = $this->model->getTranslationModel();
$translations->leftJoin('streams_streams', 'streams_streams_translations.stream_id', '=', 'streams_streams.id')->whereNull('streams_streams.id')->delete();
}
示例5: runTestMigrations
/**
* Run migrations for tables only used for testing purposes.
*
* @return void
*/
protected function runTestMigrations()
{
if (!$this->schema->hasTable('fruits')) {
$this->schema->create('fruits', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('price');
$table->boolean('is_rotten');
$table->timestamps();
});
}
}
示例6: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if ($connection = Capsule::connection($this->getConnection())) {
$connection->useDefaultSchemaGrammar();
} else {
$app = app();
$connection = $app['db']->connection($this->getConnection());
}
$schema = new Schema($connection);
if (!$schema->hasTable('salesforce_tokens')) {
$schema->create('salesforce_tokens', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('access_token');
$table->string('refresh_token');
$table->string('instance_base_url');
$table->bigInteger('user_id');
$table->datetime('expires')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
}
示例7: hasTable
/**
* Determine if the given table exists.
*
* @param string $table
* @return bool
* @static
*/
public static function hasTable($table)
{
return \Illuminate\Database\Schema\Builder::hasTable($table);
}
示例8: createIfNotExists
public function createIfNotExists($table, Closure $callback, Builder $builder)
{
if (!$builder->hasTable($table)) {
$builder->create($table, $callback);
}
}
示例9: createGalleryThumbnailTable
protected function createGalleryThumbnailTable(Builder $schema)
{
if ($schema->hasTable('board_gallery_thumbs') === false) {
$schema->create('board_gallery_thumbs', function (Blueprint $table) {
$table->engine = "InnoDB";
$table->string('targetId', 255);
$table->string('boardThumbnailFileId', 255);
$table->string('boardThumbnailExternalPath', 255);
$table->string('boardThumbnailPath', 255);
$table->primary(array('targetId'));
});
}
}
示例10: hasTable
/**
* Determine if the given table exists.
*
* @param string $table
*
* @return bool
*/
public function hasTable($table)
{
return static::$schema->hasTable($table);
}