Skip to content

Commit

Permalink
🧹 Marketplace: Add Foreign key for TaxRate#bazaar (#1468)
Browse files Browse the repository at this point in the history
* `Marketplace`: Add Foreign key for `TaxRate#bazaar`

- #1137

Apply after #1466

* `Marketplace`: Run the validation on the `TaxRate` field

OK, so I *think* this actually wants to be in the same pr that adds
them, just a different migration.
  • Loading branch information
zspencer authored May 17, 2023
1 parent db82ab6 commit 3598c2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MarketplaceTaxRatesAddForeignKeyToBazaarId < ActiveRecord::Migration[7.0]
def change
add_foreign_key :marketplace_tax_rates, :spaces, column: :bazaar_id, validate: false
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MarketplaceTaxRatesValidatesBazaarIdForeignKey < ActiveRecord::Migration[7.0]
def change
validate_foreign_key :marketplace_tax_rates, :spaces, column: :bazaar_id, validate: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_05_14_174823) do
ActiveRecord::Schema[7.0].define(version: 2023_05_14_195459) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -276,6 +276,7 @@
add_foreign_key "marketplace_products", "furnitures", column: "marketplace_id"
add_foreign_key "marketplace_shoppers", "people"
add_foreign_key "marketplace_tax_rates", "furnitures", column: "marketplace_id"
add_foreign_key "marketplace_tax_rates", "spaces", column: "bazaar_id"
add_foreign_key "memberships", "invitations"
add_foreign_key "space_agreements", "spaces"
add_foreign_key "spaces", "rooms", column: "entrance_id"
Expand Down

0 comments on commit 3598c2e

Please sign in to comment.