Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Create migration for drop table if a entire schema is deleted from OpenAPI spec #132

Open
SOHELAHMED7 opened this issue Jan 19, 2023 · 3 comments · May be fixed by SOHELAHMED7/yii2-openapi#29
Labels
enhancement New feature or request generator-feature Functionality missing from the generator
Milestone

Comments

@SOHELAHMED7
Copy link
Contributor

SOHELAHMED7 commented Jan 19, 2023

Also ensure its down code have correct migrations code to create table

SOHELAHMED7 added a commit to SOHELAHMED7/yii2-openapi that referenced this issue Jan 19, 2023
@SOHELAHMED7
Copy link
Contributor Author

SOHELAHMED7 commented Jan 19, 2023

Stub (and partially failing test ) is present in c859fea

@cebe
Copy link
Owner

cebe commented Jan 27, 2023

I should be possible to disable this feature to allow having tables in the same database that are not managed by yii2-openapi.

@cebe cebe added enhancement New feature or request generator-feature Functionality missing from the generator labels Jan 27, 2023
@cebe cebe added this to the 2.0 milestone Jan 27, 2023
@SOHELAHMED7
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request generator-feature Functionality missing from the generator
Projects
Status: 📋 Backlog
2 participants