Explain the "why"
All foreign keys use `RESTRICT`, so cascades can never change the data of finished stages.
This commit is contained in:
parent
bf2749cf61
commit
8a96e78533
10 changed files with 22 additions and 0 deletions
|
|
@ -76,6 +76,8 @@ class Address(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["primary_id"],
|
||||
["addresses.id"],
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ class Path(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
#
|
||||
# The two `Address` objects must be in the same `.city`
|
||||
sa.ForeignKeyConstraint(
|
||||
["first_address_id", "city_id"],
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class AddressPixelAssociation(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
#
|
||||
# An `Address` can only be on a `Grid` ...
|
||||
sa.ForeignKeyConstraint(
|
||||
["address_id", "city_id"],
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ class Forecast(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["pixel_id"],
|
||||
["pixels.id"],
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ class Grid(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["city_id"],
|
||||
["cities.id"],
|
||||
|
|
|
|||
|
|
@ -243,6 +243,8 @@ class Order(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["customer_id"],
|
||||
["customers.id"],
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ class Pixel(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["grid_id"],
|
||||
["grids.id"],
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ class ReplayedOrder(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["simulation_id"],
|
||||
["replay_simulations.id"],
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ class ReplaySimulation(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["city_id"],
|
||||
["cities.id"],
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ class Restaurant(meta.Base):
|
|||
|
||||
# Constraints
|
||||
__table_args__ = (
|
||||
# All foreign keys `RESTRICT`
|
||||
# because data of finished stages must never change through cascades
|
||||
sa.ForeignKeyConstraint(
|
||||
["address_id"],
|
||||
["addresses.id"],
|
||||
|
|
|
|||
Loading…
Reference in a new issue