yii2-openapi
yii2-openapi copied to clipboard
Create migration for drop table if a entire schema is deleted from OpenAPI spec
Ensure its down code have correct migrations code to create table
Stub (and partially failing test ) is present in c859fea47314cf491390e25a3ab8f193f02d3602
I should be possible to disable this feature to allow having tables in the same database that are not managed by yii2-openapi.
I am going to design this as:
x-delete-tables root key (having array value). If a schema is removed then its table should be dropped. In order to create migration for it, table name (which correspond to schema) should be added to x-delete-tables.
This is designed like because often database is used by several teams/individuals and if a team/individual does not have to deal with OpenAPI spec then they are not needed to touch spec file. Only the ones who are dealing with spec should worry about dropping the table of schema which is entirely removed.
Example:
openapi: "3.0.0"
info:
version: 1.0.0
title: 132_create_migration_for_drop_table \#132
x-delete-tables:
- table_1
- table_2
paths:
/:
get:
summary: List
operationId: list
responses:
'200':
description: The information
...
So if a schema is removed, one must put its table name in x-delete-tables to create its drop migrations.