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
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["primary_id"],
|
["primary_id"],
|
||||||
["addresses.id"],
|
["addresses.id"],
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ class Path(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__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`
|
# The two `Address` objects must be in the same `.city`
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["first_address_id", "city_id"],
|
["first_address_id", "city_id"],
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ class AddressPixelAssociation(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
|
#
|
||||||
# An `Address` can only be on a `Grid` ...
|
# An `Address` can only be on a `Grid` ...
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["address_id", "city_id"],
|
["address_id", "city_id"],
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@ class Forecast(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["pixel_id"],
|
["pixel_id"],
|
||||||
["pixels.id"],
|
["pixels.id"],
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ class Grid(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["city_id"],
|
["city_id"],
|
||||||
["cities.id"],
|
["cities.id"],
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,8 @@ class Order(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["customer_id"],
|
["customer_id"],
|
||||||
["customers.id"],
|
["customers.id"],
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ class Pixel(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["grid_id"],
|
["grid_id"],
|
||||||
["grids.id"],
|
["grids.id"],
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ class ReplayedOrder(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["simulation_id"],
|
["simulation_id"],
|
||||||
["replay_simulations.id"],
|
["replay_simulations.id"],
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ class ReplaySimulation(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["city_id"],
|
["city_id"],
|
||||||
["cities.id"],
|
["cities.id"],
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ class Restaurant(meta.Base):
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
|
# All foreign keys `RESTRICT`
|
||||||
|
# because data of finished stages must never change through cascades
|
||||||
sa.ForeignKeyConstraint(
|
sa.ForeignKeyConstraint(
|
||||||
["address_id"],
|
["address_id"],
|
||||||
["addresses.id"],
|
["addresses.id"],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue