mongo-migrate-ts icon indicating copy to clipboard operation
mongo-migrate-ts copied to clipboard

chore: Highlight access to client instance and apply 'void | never' as output type for MigrationInterface public methods

Open Mifrill opened this issue 1 year ago • 5 comments

  • ~Unify arguments and types for MigrationInterface public methods everywhere (doc/template/declare)~ [In README] Highlight access to client instance as the second argument for migration methods.
  • Apply | never type for MigrationInterface public methods due to error possibility during execution.

Mifrill avatar Oct 18 '23 09:10 Mifrill

Hey @mycodeself please have a look 🙏

Mifrill avatar Mar 13 '24 18:03 Mifrill

Hey @mycodeself just a gentle reminder, please check this one 🙏

Mifrill avatar May 15 '24 07:05 Mifrill

Hey @Mifrill

I've reviewed your changes and while I'm in favor of unifying the <void | never> types you suggest, I am not so much in favor of passing by default the client argument even though it is not necessary.

I believe the default basic usage should be kept as simple as possible, that said, I am open to your opinion on this and what motivates you to make these changes.

Thanks for contributing!

mycodeself avatar May 16 '24 20:05 mycodeself

Hey @mycodeself thanks for the update.

Regarding:

I am not so much in favor of passing by default the client argument even though it is not necessary.

My main intention was to highlight the access to client object as a second argument for a migration function (up(db: Db, client: MongoClient)), because, while looking at up(db: Db), to me, it was not quite clear that we have access to client instance via second argument.

I agree with your concern about keeping it as simple as possible. I suggest keeping migrations files unchanged (up(db: Db)) but keep the highlighting of that access to the client instance (up(db: Db, client: MongoClient)) in the README file in all examples, although it mentioned in Transactions section.


Update:

I removed the client reference in the default template - https://github.com/mycodeself/mongo-migrate-ts/pull/98/commits/6455efb3bd01e0e7cf7f62d8a076a7883e63c449

Mifrill avatar May 16 '24 21:05 Mifrill

Hi @mycodeself just another gentle reminder, please have a look 🙏

Mifrill avatar Aug 08 '24 11:08 Mifrill

@Mifrill thanks a lot for your contribution!

mycodeself avatar Aug 13 '24 22:08 mycodeself

:tada: This PR is included in version 1.6.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

mycodeself avatar Aug 13 '24 23:08 mycodeself