In Laravel we have a users migration that comes by default with the following structure
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
Which we create from console with the following command
php artisan migrate
This will generate that all the migrations are executed and therefore all the tables are created, one for each migration file
However, the detail is as follows; I insert a row of data from the Maria DB console
MariaDB [blog]> insert into users(name, email, email_verified_at, password, remember_token, created_at, updated_at)
-> values
-> ("alfa", "[email protected]", NULL, "dsfdfsfsf", "dfsdf765675", NOW(), NOW());
Query OK, 1 row affected (0.077 sec)
MariaDB [blog]> SELECT * FROM users;
+----+------+---------------+-------------------+-----------+----------------+---------------------+---------------------+
| id | name | email | email_verified_at | password | remember_token | created_at | updated_at |
+----+------+---------------+-------------------+-----------+----------------+---------------------+---------------------+
| 1 | alfa | [email protected] | NULL | dsfdfsfsf | dfsdf765675 | 2018-10-06 14:11:10 | 2018-10-06 14:11:10 |
+----+------+---------------+-------------------+-----------+----------------+---------------------+---------------------+
The problem now is
I need to add a column to that table called features of type JSON but I need to keep the existing data; therefore I can not execute the migration again by altering the original structure
How do I achieve it?