Skip to content

DB2 by default does NOT enable foreign key constraints #45

Open
@victorterpstra

Description

@victorterpstra

DB2 by default does not enable ('enforce') foreign key checks.
Tables will be created with the NOT ENFORCED option.

According to https://www.ibm.com/docs/en/db2/10.5?topic=constraints-creating-modifying, after the table has been created it needs to be modified using an 'ALTER TABLE` SQL operation.

In order to do the ALTER, we need the name of the constraint.
That requires either:

  • Explicitly specify a unique name in a ForeignKey constraint, or
  • Enable automated naming sqlalchemy.MetaData(schema=schema, naming_convention=CONVENTION)

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions