Reputation: 57
I am trying to remove the unique key from complaint_number
column with migration because my app is on production and can't figure it up....
this is what I have right now:
public function up()
{
Schema::create('complaints', function(Blueprint $table)
{
$table->increments('id');
$table->integer('user_id');
$table->string('complaint_number', 7)->unique();
$table->string('address');
$table->timestamps();
});
}
Upvotes: 0
Views: 144
Reputation: 29413
I assume that migration have already been run, so what you need to do is to create a new migration and in that drop the unique index.
php artisan migrate:make drop_complaint_number_unique_index
And this for the up
method:
Schema::table('complaint', function(Blueprint $table) {
$table->dropIndex('complaints_complaint_number_unique');
}
And this for the down
method (re-add the unique index):
Schema::table('complaint', function(Blueprint $table) {
$table->unique(['complaint_number']);
}
Upvotes: 1