|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use Cycle\Schema\Generator; |
6 | | -use Spiral\Database\Driver\SQLite\SQLiteDriver; |
7 | 5 | use Yiisoft\Assets\AssetManager; |
8 | 6 | use Yiisoft\Definitions\Reference; |
9 | 7 | use Yiisoft\ErrorHandler\Middleware\ErrorCatcher; |
10 | 8 | use Yiisoft\Router\Middleware\Router; |
11 | 9 | use Yiisoft\Yii\Cycle\Command\Schema; |
12 | 10 | use Yiisoft\Yii\Cycle\Command\Migration; |
13 | | -use Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider; |
| 11 | +use Yiisoft\Yii\Cycle\Schema\Conveyor\AttributedSchemaConveyor; |
14 | 12 | use Yiisoft\Yii\Cycle\Schema\SchemaProviderInterface; |
15 | 13 | use Yiisoft\Yii\Middleware\SubFolder; |
16 | 14 |
|
|
69 | 67 | // DBAL config |
70 | 68 | 'dbal' => [ |
71 | 69 | // SQL query logger. Definition of Psr\Log\LoggerInterface |
| 70 | + // For example, \Yiisoft\Yii\Cycle\Logger\StdoutQueryLogger::class |
72 | 71 | 'query-logger' => null, |
73 | 72 | // Default database |
74 | 73 | 'default' => 'default', |
|
77 | 76 | 'default' => ['connection' => 'sqlite'], |
78 | 77 | ], |
79 | 78 | 'connections' => [ |
80 | | - 'sqlite' => [ |
81 | | - 'driver' => SQLiteDriver::class, |
82 | | - 'connection' => $_ENV['YII_ENV'] === 'production' |
83 | | - ? 'sqlite:@data/db/database.db' |
84 | | - : 'sqlite:@tests/_data/database.db', |
85 | | - 'username' => '', |
86 | | - 'password' => '', |
87 | | - ], |
| 79 | + 'sqlite' => new \Cycle\Database\Config\SQLiteDriverConfig( |
| 80 | + connection: new \Cycle\Database\Config\SQLite\FileConnectionConfig( |
| 81 | + database: $_ENV['YII_ENV'] === 'production' |
| 82 | + ? '@data/db/database.db' |
| 83 | + : 'sqlite:@tests/_data/database.db' |
| 84 | + ) |
| 85 | + ), |
88 | 86 | ], |
89 | 87 | ], |
90 | 88 |
|
|
115 | 113 | * ] |
116 | 114 | */ |
117 | 115 | 'schema-providers' => [ |
118 | | - // Uncomment next line to enable schema cache |
119 | | - // SimpleCacheSchemaProvider::class => ['key' => 'cycle-orm-cache-key'], |
120 | | - FromConveyorSchemaProvider::class => [ |
| 116 | + // Uncomment next line to enable a Schema caching in the common cache |
| 117 | + // \Yiisoft\Yii\Cycle\Schema\Provider\SimpleCacheSchemaProvider::class => ['key' => 'cycle-orm-cache-key'], |
| 118 | + |
| 119 | + // Store generated Schema in the file |
| 120 | + \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::class => [ |
| 121 | + 'mode' => \Yiisoft\Yii\Cycle\Schema\Provider\PhpFileSchemaProvider::MODE_WRITE_ONLY, |
| 122 | + 'file' => 'runtime/schema.php', |
| 123 | + ], |
| 124 | + |
| 125 | + \Yiisoft\Yii\Cycle\Schema\Provider\FromConveyorSchemaProvider::class => [ |
121 | 126 | 'generators' => [ |
122 | | - Generator\SyncTables::class, |
| 127 | + Cycle\Schema\Generator\SyncTables::class, // sync table changes to database |
123 | 128 | ], |
124 | 129 | ], |
125 | 130 | ], |
|
129 | 134 | * Annotated entity directories list. |
130 | 135 | * {@see \Yiisoft\Aliases\Aliases} are also supported. |
131 | 136 | */ |
132 | | - 'annotated-entity-paths' => [ |
| 137 | + 'entity-paths' => [ |
133 | 138 | '@src', |
134 | 139 | ], |
| 140 | + 'conveyor' => AttributedSchemaConveyor::class, |
135 | 141 | ], |
| 142 | + |
136 | 143 | 'yiisoft/yii-swagger' => [ |
137 | 144 | 'annotation-paths' => [ |
138 | 145 | '@src', |
|
0 commit comments