-
Notifications
You must be signed in to change notification settings - Fork 143
Description
PHP Version
8.1.13
CodeIgniter4 Version
4.3.3
Shield Version
1.0.0-beta.5
Which operating systems have you tested for this bug?
Windows
Which server did you use?
cli-server (PHP built-in webserver)
Database
8.0.31 - MySQL Community Server - GPL
Did you customize Shield?
No
What happened?
I got Specified key was too long; max key length is 1000 bytes error after running
php spark shield:setup
- Only tow empty tables are successfully created : users and migrations
- My database use utf8mb4_general_ci as default collation with a default utf8mb4 characterset but schield force user to implement utf8mb3_general_ci/utf8mb3
Steps to Reproduce
composer config minimum-stability devcomposer config prefer-stable truecomposer require codeigniter4/shieldphp spark shield:setup
Expected Output
Normal behavior
Anything else?
Further
1. I added some log to CodeIgniter\Database\BaseConnection
ERROR - 2023-04-24 10:03:40 --> mysqli_sql_exception: Specified key was too long; max key length is 1000 bytes in C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php:295 Stack trace: #0 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\MySQLi\Connection.php(295): mysqli->query('CREATE TABLE a...', 0)
#1 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\BaseConnection.php(694):
CodeIgniter\Database\MySQLi\Connection->execute('CREATE TABLE a...') #2 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\BaseConnection.php(605): CodeIgniter\Database\BaseConnection->simpleQuery('CREATE TABLE a...')
#3 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\Forge.php(546):
CodeIgniter\Database\BaseConnection->query('CREATE TABLE a...') #4 C:\wamp64\www\mywebapp\vendor\codeigniter4\shield\src\Database\Migrations\2020-12-28-223112_create_auth_tables.php(67): **CodeIgniter\Database\Forge->createTable('auth_identities')** #5 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\MigrationRunner.php(877): **CodeIgniter\Shield\Database\Migrations\CreateAuthTables->up()** #6 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Database\MigrationRunner.php(188): **CodeIgniter\Database\MigrationRunner->migrate('up', Object(stdClass))** #7 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\Commands\Database\Migrate.php(84): **CodeIgniter\Database\MigrationRunner->latest(NULL)** #8 C:\wamp64\www\mywebapp\vendor\codeigniter4\shield\src\Commands\Setup.php(308): **CodeIgniter\Commands\Database\Migrate->run(Array)** #9 C:\wamp64\www\mywebapp\vendor\codeigniter4\shield\src\Commands\Setup.php(92): **CodeIgniter\Shield\Commands\Setup->runMigrations()** #10 C:\wamp64\www\mywebapp\vendor\codeigniter4\shield\src\Commands\Setup.php(79): **CodeIgniter\Shield\Commands\Setup->publishConfig()** #11 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\CLI\Commands.php(65): **CodeIgniter\Shield\Commands\Setup->run(Array)** #12 C:\wamp64\www\mywebapp\vendor\codeigniter4\framework\system\CLI\Console.php(37): **CodeIgniter\CLI\Commands->run('shield:setup', Array)** #13 C:\wamp64\www\mywebapp\spark(97): CodeIgniter\CLI\Console->run() #14 {main} ERROR - 2023-04-24 10:03:40 --> Shield Query CREATE TABLE auth_identities(idint(11) UNSIGNED NOT NULL AUTO_INCREMENT,user_idint(11) UNSIGNED NOT NULL,typevarchar(255) NOT NULL,namevarchar(255) NULL,secretvarchar(255) NOT NULL,secret2varchar(255) NULL,expiresdatetime NULL,extratext NULL,force_resettinyint(1) NOT NULL DEFAULT 0,last_used_atdatetime NULL,created_atdatetime NULL,updated_atdatetime NULL, CONSTRAINTpk_auth_identities PRIMARY KEY(id), CONSTRAINT auth_identities_user_id_foreign FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, UNIQUE KEY type_secret (type, secret), KEY user_id (user_id) ) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ERROR - 2023-04-24 10:03:40 --> Shield Query error CREATE TABLE auth_identities` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` int(11) UNSIGNED NOT NULL,
`type` varchar(255) NOT NULL,
`name` varchar(255) NULL,
`secret` varchar(255) NOT NULL,
`secret2` varchar(255) NULL,
`expires` datetime NULL,
`extra` text NULL,
`force_reset` tinyint(1) NOT NULL DEFAULT 0,
`last_used_at` datetime NULL,
`created_at` datetime NULL,
`updated_at` datetime NULL,
CONSTRAINT `pk_auth_identities` PRIMARY KEY(`id`),
CONSTRAINT `auth_identities_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
UNIQUE KEY `type_secret` (`type`, `secret`),
KEY `user_id` (`user_id`)
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci
ERROR - 2023-04-24 10:03:40 --> Shield Query error MessageSpecified key was too long; max key length is 1000 bytes
ERROR - 2023-04-24 10:03:40 --> Shield Query error code1071
`