Skip to content

Remove usage of index_schema_history instead use pg_indexes#244

Open
vishalhaven wants to merge 54 commits intohaven-life:masterfrom
vishalhaven:cap/feature/HL-78637-remove-history-table
Open

Remove usage of index_schema_history instead use pg_indexes#244
vishalhaven wants to merge 54 commits intohaven-life:masterfrom
vishalhaven:cap/feature/HL-78637-remove-history-table

Conversation

@vishalhaven
Copy link
Copy Markdown
Contributor

No description provided.

@vishalhaven vishalhaven changed the title Remove usage of index_schema_history instead using pg_indexes Remove usage of index_schema_history instead use pg_indexes Apr 27, 2023
"name": "@haventech/persistor",
"description": "A subclass of supertype that serializes to and reconstitutes from MongoDB or SQL databases",
"homepage": "https://github.com/haven-life/persistor",
"version": "12.0.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets point the MR to latest master, which is already published.
Also this would be a feature MR not a bug fix bump.

"version": "12.0.0",
"version": "12.0.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Copy link
Copy Markdown
Contributor

@kamranHaven kamranHaven Apr 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have a test case failure (pipeline seems to be failing)

can we make sure to add unit tests around:

  1. no warning message is created if we are deleting an index that is already deleted
  2. no warning message is created if we insert an index that was already created
  3. If a new index is added in schema file, then pg_indexes has that index.
  4. If that same index is deleted from schema file, pg_indexes removes it without impacting any other index
  5. Create invalid index where column doesn't exist
  6. update index (valid and invalid case)
  7. delete index where column is deleted.

Regression:
We would also test regression against some large repo like haven and run their startup.

  1. We would need to test above listed scenarios for a blank db (history table empty to mimic fresh db). In a fresh db, history table wont be created. However the pg_indexes initially without the user added indexes, would get populated with the indexes from schema and the ones created by amorphic.

  2. Then we would also want to test with an existing history table (uat / prod scenario) that this feature, stops incrementing the rows in history table, and not delete history table or its contents. However, any adds, updates and deletes to indexes are correctly reflecting.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kamranHaven I have covered all the scenarios you mention in the comments.

About the regression:

  1. I have tested with blank db -> works as expected. We need to double the indexes created by the amorphic one.
  2. Not sure how I should test it. I'll check with the PA repo if there are any changes in the schema/indexes/columns and maybe try to run a startup.

@vishalhaven vishalhaven changed the base branch from cap/feature/HL-00000-es2020-typescript-upgrade-with-master-semotus to master May 1, 2023 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants