diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 897d747d3..290a0e750 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -38,15 +38,15 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0, 8.1] - laravel: ["8.*", "9.*"] - laravel-require: [8.0] + php: [8.2] + laravel: ["11.*"] + laravel-require: [11.0] mysql-version: [8.0] coverage: [none] include: - - php: 8.1 - laravel: 9.* - laravel-require: 8.0 + - php: 8.2 + laravel: 11.* + laravel-require: 11.0 mysql-version: 8.0 coverage: xdebug @@ -130,8 +130,8 @@ jobs: sed -i 's/DB_PASSWORD=/DB_PASSWORD=postgres/g' .env && sed -i 's/DB_HOST=127.0.0.1/DB_HOST=localhost/g' .env && sed -i 's/DB_USERNAME=root/DB_USERNAME=postgres/g' .env && - sed -i 's/DB_PORT=3306/DB_PORT=5432/g' .env - + sed -i 's/DB_PORT=3306/DB_PORT=5432/g' .env + # Pgsql | Laravel setup - name: Pgsql | Laravel setup diff --git a/src/Database/Schema/SchemaManager.php b/src/Database/Schema/SchemaManager.php index 2bc4b4e48..a1c3d5974 100644 --- a/src/Database/Schema/SchemaManager.php +++ b/src/Database/Schema/SchemaManager.php @@ -39,18 +39,14 @@ public static function tableExists($table) public static function listTables() { - // $sm = static::registerConnection()->createSchemaManager(); - // $list_tables = $sm->listTables(); - $sm = Schema::getTables(); - + $tables = []; - + foreach ($sm as $key => $table_name) { - // $tables[$table_name["name"]] = static::listTableDetails($table_name["name"]); $tables[$table_name["name"]] = $table_name["name"]; } - + return $tables; } @@ -62,14 +58,14 @@ public static function listTableDetails($table_name) { $sm =static::registerConnection()->createSchemaManager(); $columns = $sm->listTableColumns($table_name); - + $foreign_keys = []; if (static::registerConnection()->getDatabasePlatform()->supportsForeignKeyConstraints()) { $foreign_keys = $sm->listTableForeignKeys($table_name); } $indexes = $sm->listTableIndexes($table_name); - + return new Table($table_name, $columns, $indexes, [],$foreign_keys, []); } @@ -77,24 +73,25 @@ public static function registerConnection() { $databaseConfig = config('database.connections.' . config('database.default')); $driver_name = DB::getDriverName(); - if($driver_name == 'mysql' || $driver_name = 'pgsql') { + + if($driver_name == 'mysql' || $driver_name == 'pgsql') { $connectionParams = [ 'dbname' => $databaseConfig['database'], 'user' => $databaseConfig['username'], 'password' => $databaseConfig['password'], 'host' => $databaseConfig['host'], - 'driver' => 'pdo_' . $driver_name, + 'driver' => 'pdo_' . $driver_name, 'port' => $databaseConfig['port'], ]; - } else { + } + + if ($driver_name == 'sqlite') { $connectionParams = [ - 'user' => $databaseConfig['username'], - 'password' => $databaseConfig['password'], 'path' => $databaseConfig['database'], - 'driver' => 'pdo_' . $driver_name, + 'driver' => 'pdo_' . $driver_name, ]; } - + $doctrine_connection = DriverManager::getConnection($connectionParams); return $doctrine_connection; @@ -111,7 +108,7 @@ public static function describeTable($table_name) Type::registerCustomPlatformTypes(); $table = static::listTableDetails($table_name); - + return collect($table->columns)->map(function ($column) use ($table) { $column_array = Column::toArray($column); diff --git a/src/Database/Types/Common/VarCharType.php b/src/Database/Types/Common/VarCharType.php index 235314abf..a7f1a97f3 100644 --- a/src/Database/Types/Common/VarCharType.php +++ b/src/Database/Types/Common/VarCharType.php @@ -6,10 +6,10 @@ class VarCharType extends DoctrineStringType { - const NAME = 'varchar'; + const NAME = 'string'; public function getName() { - return static::NAME; + return 'varchar'; } } diff --git a/src/Database/Types/Type.php b/src/Database/Types/Type.php index b973ebffe..c575cb702 100644 --- a/src/Database/Types/Type.php +++ b/src/Database/Types/Type.php @@ -87,13 +87,14 @@ public static function registerCustomPlatformTypes($force = false) $doctrine_connection = SchemaManager::registerConnection(); $platform = $doctrine_connection->getDatabasePlatform(); - $platform_name = ucfirst(DB::getDriverName()); + // $platform_name = ucfirst(DB::getDriverName()); + $platform_name = ucfirst($platform->getName()); $custom_types = array_merge( static::getPlatformCustomTypes('Common'), static::getPlatformCustomTypes($platform_name) ); - + foreach ($custom_types as $type) { $name = $type::NAME; diff --git a/src/Helpers/DataTypeToComponent.php b/src/Helpers/DataTypeToComponent.php index f59161e42..ca982623e 100644 --- a/src/Helpers/DataTypeToComponent.php +++ b/src/Helpers/DataTypeToComponent.php @@ -8,6 +8,7 @@ class DataTypeToComponent protected static $type_list = [ 'CHAR' => 'text', 'VARCHAR' => 'text', + 'STRING' => 'text', 'BINARY' => 'text', 'VARBINARY' => 'text', 'TINYBLOB' => 'text',