Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Migrations in modules?
#3

Hi

Thanks for the response.

My Directory layout is as follows ...

App/ ...
Standard/Auth/Database/Migrations/
System/ ...

etc

My migration file in the above migration dir is 20190427134005_add_auth_users.php

and contains the following ...

PHP Code:
<?php namespace App\Database\Migrations;

use 
CodeIgniter\Database\Migration;

class 
Migration_Add_auth_users extends Migration
{
 public function 
up()
 {
 
$fields = [
 
'id' => ['type' => 'INT''constraint' => 9'unsigned' => true'auto_increment' => true],
 
'title'  => ['type' => 'VARCHAR''constraint' => '100''unique' => true]
 ];

 
$this->forge->addField($fields);
 
$this->forge->addKey('id'true);
 
$this->forge->createTable('users');
 }

 
//--------------------------------------------------------------------

 
public function down()
 {
 
$this->forge->dropTable('users');
 }


I then execute the following in the terminal ...

PHP Code:
php spark migrate:latest -all 

Which is supposed to run all the migrations, but doesnt, only the ones located in the main app directory.

My autoload.php file in the main app config dir is changed as follows ...

PHP Code:
$psr4 = [
 
'Config'      => APPPATH 'Config',
 
APP_NAMESPACE => APPPATH               // For custom namespace
 
'App'         => APPPATH               // To ensure filters, etc still found,
 
'Standard'    => APPPATH '../standard'
]; 

I dunno what I'm doing wrong.
Reply


Messages In This Thread
[SOLVED] Migrations in modules? - by MeltedRolo - 04-27-2019, 01:33 PM
RE: Migrations in modules? - by InsiteFX - 04-27-2019, 03:09 PM
RE: Migrations in modules? - by MeltedRolo - 04-27-2019, 03:28 PM
RE: Migrations in modules? - by InsiteFX - 04-28-2019, 03:29 AM
RE: Migrations in modules? - by MGatner - 04-28-2019, 03:57 AM
RE: Migrations in modules? - by MeltedRolo - 04-28-2019, 05:04 AM
RE: Migrations in modules? - by MeltedRolo - 04-28-2019, 10:44 AM
RE: Migrations in modules? - by MeltedRolo - 04-28-2019, 01:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB