'onInitSchemaCreator', ]; } /** * @param SchemaCollection $collection * * @return SchemaCollection */ public static function registerTableSchemas(SchemaCollection $collection): SchemaCollection { return $collection; } /** * @param ServiceContainer $container * * @return SchemaCreator */ public static function onInitSchemaCreator(ServiceContainer $container): SchemaCreator { $db = $container->get('Database'); $versionString = $db->fetchValue('SELECT VERSION()'); $databaseDetector = new DatabaseDetector(new DatabaseVersionStringParser($versionString)); if (!$databaseDetector->isMariaDb() && !$databaseDetector->isMySQL()) { throw new SchemaCreatorMissingDriverException('Unknown Database Driver'); } $driver = new MysqlDriver( new ColumnLineGenerator($db), new IndexLineGenerator($db), new TableOptionsGenerator($db), new ConstraintLineGenerator($db) ); return new SchemaCreator($db, $driver); } }