I am using Laravel 5.2. I did create migration file with php artisan make:migration create_users_table
command. File created successfully and I did update file with this code:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->integer('partner_id');
$table->string('social_id');
$table->integer('device_id');
$table->integer('gcm_id');
$table->integer('user_role');
$table->string('social_media');
$table->string('display_name');
$table->string('first_name');
$table->string('last_name');
$table->integer('status');
$table->string('email')->unique();
$table->string('password');
$table->string('profile_pic');
$table->string('gender');
$table->float('height');
$table->float('weight');
$table->string('dob');
$table->bigInteger('mobile');
$table->string('city');
$table->string('state');
$table->integer('zip');
$table->string('country');
$table->float('latitude');
$table->float('longitude');
$table->float('gps_status');
$table->string('favorite_movie');
$table->string('favorite_food');
$table->string('favorite_weather');
$table->integer('login_status');
$table->string('active');
$table->string('token');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}`
for running migration i use this 'php artisan migrate' command. and error occurs
'Migration table created successfully.
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of '.\laravel\users' to '.\laravel#sql2-1d88-70' (errno: 190 - Operation not allowed when innodb_forced_recov ery > 0) (SQL: alter table
users
add uniqueusers_email_unique
([PDOException] SQLSTATE[HY000]: General error: 1025 Error on rename of '.\laravel\users' to '.\laravel#sql2-1d88-70' (errno: 190 - Operation not allowed when innodb_forced_recov ery > 0)'
After that I used rollback command php artisan migrate:rollback
but message shows nothing to rollback and when I want to create second table the message shows the user table already exist
.
php artisan migrate:fresh
? it looks like you have the old database still there – Touchpad