/** * 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'); }); } }
/** * 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); }
/** * 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); }); }
/** * 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(); }
/** * 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(); }); } }
/** * 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(); }); } }
/** * Determine if the given table exists. * * @param string $table * @return bool * @static */ public static function hasTable($table) { return \Illuminate\Database\Schema\Builder::hasTable($table); }
public function createIfNotExists($table, Closure $callback, Builder $builder) { if (!$builder->hasTable($table)) { $builder->create($table, $callback); } }
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')); }); } }
/** * Determine if the given table exists. * * @param string $table * * @return bool */ public function hasTable($table) { return static::$schema->hasTable($table); }