PHP Version
8.2
CodeIgniter4 Version
4.4.1
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MySQL 8
What happened?
Currently my project has two database groups, "default" and "test", I am currently developing and using the "test" database, and I configure in my .env file the following:
#--------------------------------------------------------------------# ENVIRONMENT#--------------------------------------------------------------------CI_ENVIRONMENT=development
...
#--------------------------------------------------------------------# DATABASE#--------------------------------------------------------------------database.defaultGroup=testsdatabase.tests.hostname=localhostdatabase.tests.database=macc_testsdatabase.tests.username=rootdatabase.tests.password=database.tests.DBDriver=MySQLidatabase.tests.DBPrefix=database.tests.charset=utf8mb4database.tests.DBCollat=utf8mb4_general_cidatabase.tests.port=3306
Now when I run migration from command I have to do it like this:
php spark migrate -g test
The process runs normally, the problem is when I rollback, because when I run
php spark migrate:rollback -g tests
Since it does not make any changes, it does not delete or modify the tables
Steps to Reproduce
In .env:
#--------------------------------------------------------------------# ENVIRONMENT#--------------------------------------------------------------------CI_ENVIRONMENT=development
...
#--------------------------------------------------------------------# DATABASE#--------------------------------------------------------------------database.defaultGroup=testsdatabase.tests.hostname=localhostdatabase.tests.database=macc_testsdatabase.tests.username=rootdatabase.tests.password=database.tests.DBDriver=MySQLidatabase.tests.DBPrefix=database.tests.charset=utf8mb4database.tests.DBCollat=utf8mb4_general_cidatabase.tests.port=3306
in app\Database\Migrations\2023-10-09-190224_TipoUsuarioMigration.php, for all "Migration" files I don't add "DBGroup" property:
<?phpnamespaceApp\Database\Migrations;
useCodeIgniter\Database\Migration;
class TipoUsuarioMigration extends Migration
{
// protected $DBGroup = 'default';publicfunctionup()
{
$this->forge
->addField(
[
'id' => [
'type' => 'INT',
'auto_increment' => true,
],
'nombre' => [
'type' => 'VARCHAR',
'constraint' => 50,
],
]
)
->addPrimaryKey('id')
->createTable('tipo_usuario', true);
}
publicfunctiondown()
{
$this->forge->dropTable('tipo_usuario', true);
}
}In CLI:
php spark migrate -g testsphp spark migrate:rollback -g tests <--- doesn't work, doesn't delete the table.
Expected Output
when you run the command php spark migrate:rollback -g tests, it should modify or delete tables.
Anything else?
When I change the CI_ENVIRONMENT variable in .env like this CI_ENVIRONMENT = testing, the rollback works correctly.
PHP Version
8.2
CodeIgniter4 Version
4.4.1
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MySQL 8
What happened?
Currently my project has two database groups, "default" and "test", I am currently developing and using the "test" database, and I configure in my .env file the following:
Now when I run migration from command I have to do it like this:
php spark migrate -g testThe process runs normally, the problem is when I rollback, because when I run
php spark migrate:rollback -g testsSince it does not make any changes, it does not delete or modify the tables
Steps to Reproduce
In .env:
in app\Database\Migrations\2023-10-09-190224_TipoUsuarioMigration.php, for all "Migration" files I don't add "DBGroup" property:
In CLI:
php spark migrate -g testsphp spark migrate:rollback -g tests<--- doesn't work, doesn't delete the table.Expected Output
when you run the command
php spark migrate:rollback -g tests, it should modify or delete tables.Anything else?
When I change the CI_ENVIRONMENT variable in .env like this
CI_ENVIRONMENT = testing, the rollback works correctly.