Welcome Guest, Not a member yet? Register   Sign In
Migration on group and namespace
#1

Hi,
I'm trying to run a migration to my maindb group from my modules folder, to do this i've been reading the migration what command to use. This doesn't seem to be working and i'm wondering if it's something wrong on my side or someone has the same issue, below the coding for this and command i've used.
PHP Code:
<?php

namespace Modules\Database\Migrations;

use 
CodeIgniter\Database\Migration;

class 
ModCalendar extends Migration
{
 public function 
up()
 {
 
$this->forge->addField([
 
'id' => ['type' => 'int''constraint' => 11'unsigned' => true'auto_increment' => true],
 
'client_id' => ['type' => 'int''constraint' => 11'unsigned' => true],
 
'subject' => ['type' => 'varchar''constraint' => 255],
 
'weblink' => ['type' => 'varchar''constraint' => 255],
 
'date_start'=> ['type' => 'datetime'],
 
'date_end'  => ['type' => 'datetime''null' => true'default' => null],
 
'created_at'=> ['type' => 'datetime''null' => true'default' => null],
 
'updated_at'=> ['type' => 'datetime''null' => true'default' => null],
 
'deleted_at'=> ['type' => 'datetime''null' => true'default' => null],
 ]);

 
$this->forge->addKey('id'true);
 
$this->forge->addForeignKey('client_id''clients''id'false'CASCADE');

 
// Create table
 
$this->forge->createTable('mod_calendar');
 }

 public function 
down()
 {
 if (
$this->db->DBDriver != 'SQLite3')
        {
            $this->forge->dropForeignKey('mod_calendar''mod_calendar_client_id_foreign');
        }

 
// Drop table
 
$this->forge->dropTable('mod_calendar'true);
 }

With the cmmand:
Code:
php spark migrate -g maindb -n Modules

OR

php spark migrate -g maindb -n Modules\Calendar

Did someone encountered this issue or is it just me?
Reply


Messages In This Thread
Migration on group and namespace - by superior - 07-07-2021, 02:10 AM
RE: Migration on group and namespace - by paliz - 07-07-2021, 04:50 AM
RE: Migration on group and namespace - by paliz - 07-07-2021, 09:19 AM
RE: Migration on group and namespace - by ARAmiss - 10-18-2021, 10:51 PM
RE: Migration on group and namespace - by ARAmiss - 10-19-2021, 03:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB