makerspace / makeradmin

Stockholm Makerspace member administration and store.
20 stars 15 forks source link

Add config value STRIPE_CURRENCY #323

Closed amrsoll closed 11 months ago

amrsoll commented 11 months ago

This allows me to change the currency I use in Stripe.

I would also recommend to refactor CURRENCY -> STRIPE_CURRENCY to follow your code conventions.

I kept the changes minimal for this PR so far.

:warning: I presume this would require a migration step, which I am unsure of how to tackle.

emanuelen5 commented 11 months ago

LGTM. However, note that there are more places where we need to update the currency.

emanuelen5 commented 11 months ago

⚠️ I presume this would require a migration step, which I am unsure of how to tackle.

I don't think we need to add any migration scripts since these values only are used in runtime. Either way, I think it's very low risk that someone started using one currency and then switching to another, and that this change would affect anyone negatively. I don't think we have a lot of users in total, and even fewer outside of Sweden.

emanuelen5 commented 11 months ago

a migration step, which I am unsure of how to tackle.

Migrations are done by creating a new file in api/src/migrations/ (with higher starting number than the last file). Currently the last migration is this one: https://github.com/makerspace/makeradmin/blob/master/api/src/migrations/0023_flexible_change_phone_number.sql

The files are executed in-order on the database. They contain SQL commands that alter the database so that it matches the new database format that the code expects.

E.g. the following adds a column called _pendingactivation to the _membershipmembers table with a boolean value.

ALTER TABLE membership_members ADD COLUMN `pending_activation` boolean;

Executed migrations are stored in the database so they are not applied twice.