Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom money type #1094

Closed
Tracked by #249
kgodey opened this issue Feb 23, 2022 · 2 comments · Fixed by #1137
Closed
Tracked by #249

Custom money type #1094

kgodey opened this issue Feb 23, 2022 · 2 comments · Fixed by #1137
Assignees
Labels
type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL

Comments

@kgodey
Copy link
Contributor

kgodey commented Feb 23, 2022

Problem

We've decided to implement a custom Mathesar money type that is an alias to NUMERIC types. Currency will be specified through display options.

Proposed solution

  • Create a Money friendly type name in the service
  • Create a MATHESAR_TYPES.MONEY type in the database that store currency amounts. The amount should be a NUMERIC type.
  • Users should be able to use the API to change a column to MATHESAR_TYPES.MONEY if it's possible to do so.
  • Automatic type inference during file import suggests MATHESAR_TYPES.MONEY when it makes sense to do so.
  • Existing MATHESAR_TYPES.MONEY should be renamed to MATHESAR_TYPES.MULTICURRENCY_MONEY

Please note that this issue does not cover display options; a separate issue will be created for those once mathesar-foundation/mathesar-wiki#36 is finalized.

Additional context

@mathemancer
Copy link
Contributor

@kgodey It turns out that the previous custom type was called MATHESAR_TYPES.MATHESAR_MONEY. The reason for this is that it keeps the key money reserved for the default PostgreSQL MONEY type in a few auto-generated dictionaries. So, I've kept this for the new custom money type: It's called MATHESAR_TYPES.MATHESAR_MONEY.

@kgodey
Copy link
Contributor Author

kgodey commented Mar 4, 2022

@mathemancer Sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants