Merge pull request #18210 from civicrm/5.29
[civicrm-core.git] / xml / schema / Core / EntityFile.xml
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 <add>1.5</add>
9 <log>true</log>
10 <field>
11 <name>id</name>
12 <title>Entity File ID</title>
13 <type>int unsigned</type>
14 <required>true</required>
15 <comment>primary key</comment>
16 <add>1.5</add>
17 </field>
18 <primaryKey>
19 <name>id</name>
20 <autoincrement>true</autoincrement>
21 </primaryKey>
22 <field>
23 <name>entity_table</name>
24 <title>Entity Table</title>
25 <type>varchar</type>
26 <length>64</length>
27 <comment>physical tablename for entity being joined to file, e.g. civicrm_contact</comment>
28 <add>1.5</add>
29 </field>
30 <field>
31 <name>entity_id</name>
32 <title>Entity ID</title>
33 <type>int unsigned</type>
34 <required>true</required>
35 <comment>FK to entity table specified in entity_table column.</comment>
36 <add>1.5</add>
37 </field>
38 <dynamicForeignKey>
39 <idColumn>entity_id</idColumn>
40 <typeColumn>entity_table</typeColumn>
41 <add>1.5</add>
42 </dynamicForeignKey>
43 <index>
44 <name>index_entity</name>
45 <fieldName>entity_table</fieldName>
46 <fieldName>entity_id</fieldName>
47 <add>1.5</add>
48 </index>
49 <field>
50 <name>file_id</name>
51 <title>File</title>
52 <type>int unsigned</type>
53 <required>true</required>
54 <comment>FK to civicrm_file</comment>
55 <add>1.5</add>
56 </field>
57 <foreignKey>
58 <name>file_id</name>
59 <table>civicrm_file</table>
60 <key>id</key>
61 <add>1.5</add>
62 </foreignKey>
63 <index>
64 <name>UI_entity_table_entity_id_file_id</name>
65 <fieldName>entity_table</fieldName>
66 <fieldName>entity_id</fieldName>
67 <fieldName>file_id</fieldName>
68 <unique>true</unique>
69 <add>1.1</add>
70 </index>
71 </table>