diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-04 11:43:51 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-04 11:43:51 -0600 |
| commit | 0a2a83ed17ceb910a29596a11d7c309c3c010e7a (patch) | |
| tree | 67f174f0c392ca65c5f0854940ffb8f99a3d362a | |
| parent | 01b1c72b8bd8cd7af1d43c935a40b098fc827f7b (diff) | |
Add note on transactions in partitioning in rails
| -rw-r--r-- | README.md | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -2953,3 +2953,22 @@ Rails.application.config.generators do |g| g.orm :active_record, primary_key_type: :uuid end ``` + +## rails transactions + +```ruby +t.decimal :amount, precision: 10, scale: 2 + +class Account + def withdraw(quantity) + self.amount -= quantity + save! + end + + def deposit(quantity) + self.amount += quantity + end +end +``` + +Partition data using [pg_party](https://github.com/rkrage/pg_party) gem. |
