Skip to content

renamed foreign key table definition constraint issue #518

@ixcat

Description

@ixcat

defining a renamed foreign key reference to a partial key defined in:

class Animal(dj.Manual):
    definition = """
    animal_id : char(16)
    datasource_id=0: int
    ---
    animal_species: varchar(16)
    animal_name: varchar(128)
    animal_sex: ENUM('M', 'F', 'U')
    animal_dob=NULL: date
    -> AnimalColor
    """

via:

@schema
class Dam(dj.Manual):
    definition = """
    -> Animal
    (dam_id) -> Animal(animal_id)
    """

yields:

CREATE TABLE IF NOT EXISTS `tutorial_mlims_prod_ephys`.`dam` ( `animal_id` char(16) NOT NULL COMMENT "", `datasource_id` int NOT NULL COMMENT "", `dam_id` int NOT NULL COMMENT "", PRIMARY KEY (`animal_id`,`datasource_id`,`dam_id`), FOREIGN KEY (`animal_id`,`datasource_id`) REFERENCES `tutorial_mlims_prod_ephys`.`animal` (`animal_id`,`datasource_id`) ON UPDATE CASCADE ON DELETE RESTRICT, FOREIGN KEY (`datasource_id`,`dam_id`) REFERENCES `tutorial_mlims_prod_ephys`.`animal` (`animal_id`,`datasource_id`) ON UPDATE CASCADE ON DELETE RESTRICT ) ENGINE=InnoDB, COMMENT "";

and therefore this:

#517 code resolves issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIndicates similar issues, pull requests, or discussions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions