You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
`NOT NULL` in DB migrations is determined by `nullable` and `required` properties of the OpenAPI schema.
274
+
e.g. attribute = 'my_property'.
275
+
276
+
- If you define attribute neither "required" nor via "nullable", then it is by default `NULL`:
277
+
278
+
```yaml
279
+
ExampleSchema:
280
+
properties:
281
+
my_property:
282
+
type: string
283
+
```
284
+
285
+
- If you define attribute in "required", then it is `NOT NULL`
286
+
287
+
```yaml
288
+
ExampleSchema:
289
+
required:
290
+
- my_property
291
+
properties:
292
+
my_property:
293
+
type: string
294
+
```
295
+
296
+
- If you define attribute via "nullable", then it overrides "required", e.g. allow `NULL` in this case:
297
+
298
+
```yaml
299
+
ExampleSchema:
300
+
required:
301
+
- my_property
302
+
properties:
303
+
my_property:
304
+
type: string
305
+
nullable: true
306
+
```
307
+
308
+
- If you define attribute via "nullable", then it overrides "required", e.g. `NOT NULL` in this case:
309
+
310
+
```yaml
311
+
test_table:
312
+
required:
313
+
properties:
314
+
my_property:
315
+
type: string
316
+
nullable: false
317
+
```
318
+
319
+
### Handling of `enum` (#enum, #MariaDb)
320
+
It work on MariaDb.
321
+
322
+
```yaml
323
+
test_table:
324
+
properties:
325
+
my_property:
326
+
enum:
327
+
- one
328
+
- two
329
+
- three
330
+
```
331
+
332
+
### Handling of `numeric` (#numeric, #MariaDb)
333
+
precision-default = 10
334
+
scale-default = 2
335
+
336
+
- You can define attribute like "numeric(precision,scale)":
337
+
```yaml
338
+
test_table:
339
+
properties:
340
+
my_property:
341
+
x-db-type: decimal(12,4)
342
+
```
343
+
DB-Result = decimal(12,4)
344
+
345
+
- You can define attribute like "numeric(precision)" with default scale-default = 2:
346
+
```yaml
347
+
test_table:
348
+
properties:
349
+
my_property:
350
+
x-db-type: decimal(12)
351
+
```
352
+
DB-Result = decimal(12,2)
353
+
354
+
- You can define attribute like "numeric" with precision-default = 10 and scale-default = 2:
355
+
```yaml
356
+
test_table:
357
+
properties:
358
+
my_property:
359
+
x-db-type: decimal
360
+
```
361
+
DB-Result = decimal(10,2)
251
362
252
363
## Screenshots
253
364
@@ -259,6 +370,32 @@ Generated files:
259
370
260
371

261
372
373
+
# Development
374
+
375
+
There commands are available to develop and check the tests. It can be used inside the Docker container. To enter into bash of container run `make cli` .
376
+
377
+
```bash
378
+
./yii migrate-mysql/up
379
+
./yii migrate-mysql/down 4
380
+
381
+
./yii migrate-maria/up
382
+
./yii migrate-maria/down 4
383
+
384
+
./yii migrate-pgsql/up
385
+
./yii migrate-pgsql/down 4
386
+
```
387
+
388
+
To apply multiple migration with one command:
389
+
390
+
```bash
391
+
./yii migrate-mysql/up --interactive=0 && \
392
+
./yii migrate-mysql/down --interactive=0 4 && \
393
+
./yii migrate-maria/up --interactive=0 && \
394
+
./yii migrate-maria/down --interactive=0 4 && \
395
+
./yii migrate-pgsql/up --interactive=0 && \
396
+
./yii migrate-pgsql/down --interactive=0 4
397
+
```
398
+
262
399
# Support
263
400
264
401
**Need help with your API project?**
@@ -268,3 +405,4 @@ Professional support, consulting as well as software development services are av
268
405
https://www.cebe.cc/en/contact
269
406
270
407
Development of this library is sponsored by [cebe.:cloud: "Your Professional Deployment Platform"](https://cebe.cloud).
0 commit comments