db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel Bauman <g...@bravenet.com>
Subject [SOURCE] Issue #TRQS150 - make foreign keys sensitive to tableType in src/templates/sq...
Date Wed, 09 Apr 2003 00:51:52 GMT
You can view the issue detail at the following URL:
<http://scarab.werken.com/scarab/issues/id/TRQS150>

Type :        Patch
Issue Id :    TRQS150
Reported by: Gabriel Bauman
             neiras - (gabe@bravenet.com)

Details:

Platform: All
Operating system: Other linux
Summary: make foreign keys sensitive to tableType in src/templates/sql/base/mysql/foreignkey.vm
Description: I have patched the VelociMacro file that handles SQL generation for foreign keys
under MySql. Basically, I've made it tableType sensitive. The patch is against cvs head.

If you do not have a tableType specified in your db.props, the template assumes no support
for constraints and simply generates an index:

    # Foreign Key: service_id -> ftp_service.id
    INDEX ftp_account_subscription_FK_1 (service_id)

In this case, a comment containing a warning message about the missing features is injected
as well. I feel that this warning may clear up some confusion among new users.

If, on the other hand, you are using InnoDB tables, an index is generated as above (mysql
and InnoDB require this) and the proper FOREIGN KEY is generated as well:

    # Foreign Key: service_id -> ftp_service.id
    INDEX ftp_account_subscription_FK_1 (service_id)),
    FOREIGN KEY (service_id)
        REFERENCES ftp_service (id)
        ON DELETE CASCADE

I have taken pains to keep the output pretty at the expense of template readability.
Status: New


Mime
View raw message