| 1 | <?xml version="1.0" encoding="iso-8859-1" ?> |
| 2 | |
| 3 | <table> |
| 4 | <base>CRM/Core</base> |
| 5 | <class>EntityFile</class> |
| 6 | <name>civicrm_entity_file</name> |
| 7 | <comment>Attaches (joins) uploaded files (images, documents, etc.) to entities (Contacts, Groups, Actions).</comment> |
| 8 | <log>true</log> |
| 9 | <field> |
| 10 | <name>id</name> |
| 11 | <type>int unsigned</type> |
| 12 | <required>true</required> |
| 13 | <comment>primary key</comment> |
| 14 | <add>1.5</add> |
| 15 | </field> |
| 16 | <primaryKey> |
| 17 | <name>id</name> |
| 18 | <autoincrement>true</autoincrement> |
| 19 | </primaryKey> |
| 20 | <field> |
| 21 | <name>entity_table</name> |
| 22 | <type>varchar</type> |
| 23 | <length>64</length> |
| 24 | <comment>physical tablename for entity being joined to file, e.g. civicrm_contact</comment> |
| 25 | <add>1.5</add> |
| 26 | </field> |
| 27 | <field> |
| 28 | <name>entity_id</name> |
| 29 | <type>int unsigned</type> |
| 30 | <required>true</required> |
| 31 | <comment>FK to entity table specified in entity_table column.</comment> |
| 32 | <add>1.5</add> |
| 33 | </field> |
| 34 | <dynamicForeignKey> |
| 35 | <idColumn>entity_id</idColumn> |
| 36 | <typeColumn>entity_table</typeColumn> |
| 37 | <add>1.5</add> |
| 38 | </dynamicForeignKey> |
| 39 | <index> |
| 40 | <name>index_entity</name> |
| 41 | <fieldName>entity_table</fieldName> |
| 42 | <fieldName>entity_id</fieldName> |
| 43 | <add>1.5</add> |
| 44 | </index> |
| 45 | <field> |
| 46 | <name>file_id</name> |
| 47 | <type>int unsigned</type> |
| 48 | <required>true</required> |
| 49 | <comment>FK to civicrm_file</comment> |
| 50 | <add>1.5</add> |
| 51 | </field> |
| 52 | <foreignKey> |
| 53 | <name>file_id</name> |
| 54 | <table>civicrm_file</table> |
| 55 | <key>id</key> |
| 56 | <add>1.5</add> |
| 57 | </foreignKey> |
| 58 | <index> |
| 59 | <name>index_entity_file_id</name> |
| 60 | <fieldName>entity_table</fieldName> |
| 61 | <fieldName>entity_id</fieldName> |
| 62 | <fieldName>file_id</fieldName> |
| 63 | <add>1.1</add> |
| 64 | </index> |
| 65 | </table> |