Check if Table/Column Already Exists
public function up()
{
if (!Schema::hasTable('vendor')) {
Schema::create('vendor', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
}
public function up()
{
if (Schema::hasTable('vendor')) {
Schema::table('vendor', function (Blueprint $table) {
if (!Schema::hasColumn('vendor', 'address')) {
$table->string('address');
}
});
}
}
No comments:
Post a Comment