public function testDropColumn() { $blueprint = new Blueprint('users'); $blueprint->dropColumn('foo'); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" drop "foo"', $statements[0]); $blueprint = new Blueprint('users'); $blueprint->dropColumn(array('foo', 'bar')); $statements = $blueprint->toSql($this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table "users" drop "foo", drop "bar"', $statements[0]); }
protected function ifUsersTableExists(Blueprint $table) { if (Schema::hasColumn('users', 'name')) { $table->dropColumn('name'); } $table->string('last_name')->after('id'); $table->string('first_name')->after('id'); $table->string('avatar')->after('email'); $table->string('provider')->after('email'); $table->string('provider_id')->unique()->after('email'); $table->longText('provider_token')->after('email'); $table->string('link')->after('password'); $table->string('gender')->nullable()->after('password'); $table->boolean('verified')->default(false)->after('password'); }
/** * Excluir campo. * * @param string|array $columns * * @return \Illuminate\Support\Fluent */ public function dropColumn($columns) { $columns = is_array($columns) ? $columns : (array) func_get_args(); // Verificar se deve excluir constrain dos campos lookups antes foreach ($columns as $column) { if (ForeignKey::isAssociation($column)) { parent::dropForeign(ForeignKey::makeName($this->table, $column)); } } return parent::dropColumn($columns); }
/** * Drop NestedSet columns. * * @param \Illuminate\Database\Schema\Blueprint $table */ public static function dropColumns(Blueprint $table) { $columns = self::getDefaultColumns(); $table->dropIndex($columns); $table->dropColumn($columns); }
/** * 컬럼 제거 * * @param \Illuminate\Database\Schema\Blueprint $table schema builder * @param string $prefix column 이름 앞에 붙일 문자열 * @return void */ public function drop(Blueprint $table, $prefix = '') { $table->dropColumn(camel_case($prefix . $this->__get('name'))); }
/** * @param Blueprint $table */ public function onDatabaseDrop(Blueprint $table) { $table->dropColumn($this->getDBKey()); }
/** * Drop the field type column. * * @param Blueprint $table */ public function dropColumn(Blueprint $table) { $table->dropColumn($this->fieldType->getColumnName() . '_type'); $table->dropColumn($this->fieldType->getColumnName() . '_id'); }
/** * Drop the field type column from the table. * * @param Blueprint $table */ public function dropColumn(Blueprint $table) { // Skip if no column type. if (!$this->fieldType->getColumnType()) { return; } // Skip if the column doesn't exist. if (!$this->schema->hasColumn($table->getTable(), $this->fieldType->getColumnName())) { return; } // Drop dat 'ole column. $table->dropColumn($this->fieldType->getColumnName()); }
public function testDropColumn() { $blueprint = new Blueprint('users'); $blueprint->dropColumn('foo'); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table users drop ( foo )', $statements[0]); $blueprint = new Blueprint('users'); $blueprint->dropColumn(['foo', 'bar']); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); $this->assertEquals('alter table users drop ( foo, bar )', $statements[0]); }
/** * @expectedException BadMethodCallException */ public function testDropColumn() { $blueprint = new Blueprint('users'); $blueprint->dropColumn('foo'); $statements = $blueprint->toSql($this->getGrammar()); }
/** * Removes column for this field from our DynamicModel * * @param \Illuminate\Database\Schema\Blueprint $table * * @return $this */ public function removeFromModel(Blueprint $table) { $table->dropColumn($this->getFieldName()); return $this; }