Welcome Guest, Not a member yet? Register   Sign In
Does migration work only for default DbGroups?
#1

Hi,

I am using Version 4.1.8. I create a migration script for a database a migration script for database with group as "sqlite3"  as follows:
Code:
php spark make:migration --dbgroup "sqlite3"
When i run spark migration it gives me the following error:
Code:
Unable to connect to the database.
Main connection [MySQLi]: Access denied for user ''@'localhost' (using password: NO)
But when i set the group as "default" it work fine. Does this mean that migration scripts will only work with "default" groups? Please help.
Reply
#2

DB migration creates `migrations` table in the default DbGroup.
Reply
#3

(02-20-2022, 04:44 PM)kenjis Wrote: DB migration creates `migrations` table in the default DbGroup.

Hi,

Then what is the purpose of the --dbgroup parameter when creating the migration script using spark?
Reply
#4

(This post was last modified: 02-20-2022, 09:10 PM by kenjis.)

spark migrate --g "sqlite3" runs migration files with $DBGroup = 'sqlite3'.

Quote:Then what is the purpose of the --dbgroup parameter when creating the migration script using spark?

It has nothing to do with the migration file you creates.
It is only to create the migration file for database session.

--dbgroup    Database group to use for database sessions. Default: "default".

Code:
$ php spark help make:migration

CodeIgniter v4.1.8 Command Line Tool - Server Time: 2022-02-20 22:06:39 UTC-06:00

Usage:
  make:migration <name> [options]

Description:
  Generates a new migration file.

Arguments:
  name  The migration class name.

Options:
  --session    Generates the migration file for database sessions.
  --table      Table name to use for database sessions. Default: "ci_sessions".
  --dbgroup    Database group to use for database sessions. Default: "default".
  --namespace  Set root namespace. Default: "APP_NAMESPACE".
  --suffix    Append the component title to the class name (e.g. User => UserMigration).
Reply




Theme © iAndrew 2016 - Forum software by © MyBB