Commit d60acd0
committed
Add ItemPurchase model to track purchases
- Introduced a new `ItemPurchase` model to the SQL database, which includes fields for `id`, `item_id`, `user_id`, `quantity`, and `created_at`.
- Implemented foreign key relationships for `item_id` and `user_id` with cascade deletion.
- Added validation to ensure `quantity` is greater than or equal to 1.
- Default value for `created_at` set to the current timestamp in UTC format.1 parent 8a584ca commit d60acd0
1 file changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
| |||
0 commit comments