Welcome Guest, Not a member yet? Register   Sign In
Issues with migration
#2

Best,

You forget to fill in what datatype 'create_at' is.
Example from the documentation.


PHP Code:
$fields = [
        'created_at' => ['type' => 'DATETIME']
];
$forge->addColumn('users'$fields);
// Executes: ALTER TABLE users ADD preferences DATETIME 

But can also use the model for filling the 'created at' field.

PHP Code:
<?php namespace App\Models;

use 
CodeIgniter\Model;

class 
UserModel extends Model
{
        protected $table      'users';
        protected $primaryKey 'id';

        protected $returnType 'array';
        protected $useSoftDeletes true;

        protected $allowedFields = ['name''email'];

        protected $useTimestamps true;
        protected $createdField  'created_at';
        protected $updatedField  'updated_at';
        protected $deletedField  'deleted_at';

        protected $validationRules    = [];
        protected $validationMessages = [];
        protected $skipValidation     false;


Be sure you have added these field to your database.

André
Reply


Messages In This Thread
Issues with migration - by rahulswt7 - 11-18-2019, 08:03 AM
RE: Issues with migration - by snelledre - 11-18-2019, 09:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB