Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It is possible that hook_field_schema needs to be fixed too.
Comment | File | Size | Author |
---|---|---|---|
#40 | hook_field_schema_FK_doc.patch | 1.64 KB | yched |
#34 | hook_field_schema_FK_doc.patch | 2.16 KB | yched |
#26 | field_foreign_key.patch | 7.09 KB | chx |
#23 | drupal.field-foreign-keys.23.patch | 8.24 KB | sun |
#15 | field_foreign_key.patch | 6.91 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedNote that we are fixing this because #914458: Remove the format delete reassignment "feature" have delegated formats to contrib which has no clue where filter is. Patch in a few minutes.
Comment #2
chx CreditAttribution: chx commentedEdit: thanks goes to DamZ for the modules/system/system.api.php hunk.
Comment #3
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is a great addition, and will allow contrib to implement filter manipulation more easily if it proves to be necessary. The concept of foreign key is SQL specific, but this information can be used regardless of the way the fields are actually stored.
Comment #5
chx CreditAttribution: chx commentedNote that all 77 failures were one notice during update. Fixed that.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedSee http://drupal.org/node/45111
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedOops - wrong issue
Comment #8
vlad.leo CreditAttribution: vlad.leo commented#5: field_foreign_key.patch queued for re-testing.
Comment #9
Dries CreditAttribution: Dries commentedThis doesn't explain it for me. What is the purpose? What is a column mapping? What is a source column and what is a referenced column? I think we can do a better job documenting this feature -- especially if it is perceived as 'critical'.
Comment #10
chx CreditAttribution: chx commentedThis is a word for word copy from the schema documentation in current HEAD. Fixing that is a different issue.
Edit: http://api.drupal.org/api/group/schemaapi/7
Comment #11
yched CreditAttribution: yched commentedThen file fields need to be updated as well ? fid column is a FK to the file table.
Comment #12
hilarudeens CreditAttribution: hilarudeens commented#2: field_foreign_key.patch queued for re-testing.
Comment #13
sunThis limitation could be easily resolved by squeezing a drupal_alter() into the process, no?
Powered by Dreditor.
Comment #14
catchNot in this issue, no.
#691932: Add hook_field_schema_alter()
#872146: Impossible to alter field_schema
Comment #15
chx CreditAttribution: chx commented@yched yes THANKS!
Comment #17
chx CreditAttribution: chx commented#15: field_foreign_key.patch queued for re-testing.
Comment #18
chx CreditAttribution: chx commentedBot fluke.
Comment #19
sunStill contains the phpDoc that Dries already rejected. That said, I think it is wrong to duplicate hook_schema() documentation in field.crud.inc. We should simply refer to hook_schema() here (which badly needs to be improved; separate issue), and if a dead-simple drupal_alter() really cannot be done within this patch, then we also keep that last sentence after referring to hook_schema().
Shouldn't the foreign key of File field also use the field type as prefix to prevent potential clashes? I.e., 'file_fid'?
Powered by Dreditor.
Comment #20
chx CreditAttribution: chx commentedComment #21
chx CreditAttribution: chx commentedI have no idea what to do with the issue. Linking to hook_schema is not a healthy option idea because although the concepts are explained the same way (which is currently broken but that's not this issue) but they are not the same at all, I would believe. There is a significant difference: the left hand side of the foreign key is not necessarily in SQL. Tricky, eh?
As for $type , i only use din text because it used one function for three types and i grew uneasy. Likely overkill there too.
Comment #22
chx CreditAttribution: chx commentedI am asking Dries to look at this again. As I said, there have been no valid concerns voiced so far. The comment can (and probably needs to) be fixed in a folllowup but that's not a critical. If we let this doxygen in to hook_schema previously, there is no reason it should block a critical.
Comment #23
sungrml...
Comment #24
chx CreditAttribution: chx commentedWorks for me. (Everything works for me. Get this in and Drupal 7 out!)
Comment #26
chx CreditAttribution: chx commentedFixed the tests
Comment #28
tobiasb#26: field_foreign_key.patch queued for re-testing.
Comment #29
chx CreditAttribution: chx commentedSigh. Another bot fluke.
Comment #31
Dries CreditAttribution: Dries commentedOK, committed to CVS HEAD. I'm still not 100% convinced about this but in the spirit of making progress, it seems best to move forward with this. We can nitpick about it in the Drupal 8 development cycle.
Comment #32
David_Rothstein CreditAttribution: David_Rothstein commentedHead 2 Head issue is here: #935278: Update for foreign key support missing from text and file module
(Hopefully one of the last ones!)
Comment #34
yched CreditAttribution: yched commentedFollowup doc patch, to update the phpdoc and sample function body for hook_field_schema() accordingly.
Comment #36
moshe weitzman CreditAttribution: moshe weitzman commentedI prefer: "foreign keys": (optional) An array of Schema API column defintions
Comment #37
yched CreditAttribution: yched commentedA doc-only patch cannot introduce test fails. Looks like HEAD is broken...
@moshe : "An array of Schema API column definitions" ?
To me that sounds like array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ...)
The intent here is "what you would place in the 'foreign keys' entry in a regular hook_schema()".
Comment #38
sunWithout quotes is correct, so please revert. See http://drupal.org/node/1354 for details.
Comment #39
sun#34: hook_field_schema_FK_doc.patch queued for re-testing.
Comment #40
yched CreditAttribution: yched commentedI thought that keys composed of two words (space, not underscore : foreign keys) needed to be enclosed in quotes. If that's not the case, then here it is without quotes.
Comment #41
moshe weitzman CreditAttribution: moshe weitzman commentedOK, we are good.
Comment #42
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #43
yched CreditAttribution: yched commentedTaxonomy fields were forgotten : #970016: taxonomy_field_schema lacks any foreign key support