Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: migrate --all causes Class "SQLite3" not found error #6117

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 13, 2022

Description
Fixes codeigniter4/shield#240

See codeigniter4/shield#240 (comment)

  • skip Tests\Support namespace in not testing environments

How to Test

Tests\Support namespace is not defined in codeigniter4/CodeIgniter4.

Install appstarter.

$ composer create-project codeigniter4/appstarter ci4app

Configure default database.

Change tests database driver.

--- a/app/Config/Database.php
+++ b/app/Config/Database.php
@@ -62,7 +62,7 @@ class Database extends Config
         'username'    => '',
         'password'    => '',
         'database'    => ':memory:',
-        'DBDriver'    => 'SQLite3',
+        'DBDriver'    => 'xSQLite3',
         'DBPrefix'    => 'db_',  // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
         'pConnect'    => false,
         'DBDebug'     => (ENVIRONMENT !== 'production'),
$ php spark migrate --all

CodeIgniter v4.2.0 Command Line Tool - Server Time: 2022-06-13 16:59:14 UTC-05:00

Running all new migrations...

[Error]

Class "CodeIgniter\Database\xSQLite3\Connection" not found

at SYSTEMPATH/Database/Database.php:136

Apply this PR patch.

$ php spark migrate --all

CodeIgniter v4.2.0 Command Line Tool - Server Time: 2022-06-13 16:59:49 UTC-05:00

Running all new migrations...
Migrations complete.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 13, 2022
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂 Thanks Kenjis. I hope you don't feel like my offhand comments are generating work requests for you.

@kenjis kenjis merged commit c4901f4 into codeigniter4:develop Jun 14, 2022
@kenjis kenjis deleted the fix-migration-all-sqlite3-error branch June 14, 2022 12:18
@kenjis
Copy link
Member Author

kenjis commented Jun 14, 2022

@MGatner I also thought and this is the best solution for now.
In fact, after instantiation of the migration object, it is skipped if tests group and testing env.
But the error occurs in the instantiation.

@kenjis kenjis added the database Issues or pull requests that affect the database layer label Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them database Issues or pull requests that affect the database layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spark migrate --all causes SQLite3 error
3 participants