Skip to content

Do not create FK if exists #37

Description

@tinogis

If we are trying to create a fk constraint and it exists, fails.

We can put a constraint existence test like:

select constraint_name from information_schema.constraint_column_usage where table_name = [t_name] and constraint_name = [c_name]

or drop and create:

ALTER TABLE [t_name] DROP CONSTRAINT IF EXISTS [c_name]

in https://github.com/gisce/oopgrade/blob/661689373ae565a68f0d5400307a383b244d1109/oopgrade/oopgrade.py#L297C28-L297C29

@ecarreras @polsala

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions