profile.install

  1. 7.x drupal-7.x/modules/profile/profile.install
  2. 6.x drupal-6.x/modules/profile/profile.install

File

drupal-6.x/modules/profile/profile.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_install().
  4. */
  5. function profile_install() {
  6. // Create tables.
  7. drupal_install_schema('profile');
  8. }
  9. /**
  10. * Implementation of hook_uninstall().
  11. */
  12. function profile_uninstall() {
  13. // Remove tables
  14. drupal_uninstall_schema('profile');
  15. variable_del('profile_block_author_fields');
  16. }
  17. /**
  18. * Implementation of hook_schema().
  19. */
  20. function profile_schema() {
  21. $schema['profile_fields'] = array(
  22. 'description' => 'Stores profile field information.',
  23. 'fields' => array(
  24. 'fid' => array(
  25. 'type' => 'serial',
  26. 'not null' => TRUE,
  27. 'description' => 'Primary Key: Unique profile field ID.',
  28. ),
  29. 'title' => array(
  30. 'type' => 'varchar',
  31. 'length' => 255,
  32. 'not null' => FALSE,
  33. 'description' => 'Title of the field shown to the end user.',
  34. ),
  35. 'name' => array(
  36. 'type' => 'varchar',
  37. 'length' => 128,
  38. 'not null' => TRUE,
  39. 'default' => '',
  40. 'description' => 'Internal name of the field used in the form HTML and URLs.',
  41. ),
  42. 'explanation' => array(
  43. 'type' => 'text',
  44. 'not null' => FALSE,
  45. 'description' => 'Explanation of the field to end users.',
  46. ),
  47. 'category' => array(
  48. 'type' => 'varchar',
  49. 'length' => 255,
  50. 'not null' => FALSE,
  51. 'description' => 'Profile category that the field will be grouped under.',
  52. ),
  53. 'page' => array(
  54. 'type' => 'varchar',
  55. 'length' => 255,
  56. 'not null' => FALSE,
  57. 'description' => "Title of page used for browsing by the field's value",
  58. ),
  59. 'type' => array(
  60. 'type' => 'varchar',
  61. 'length' => 128,
  62. 'not null' => FALSE,
  63. 'description' => 'Type of form field.',
  64. ),
  65. 'weight' => array(
  66. 'type' => 'int',
  67. 'not null' => TRUE,
  68. 'default' => 0,
  69. 'size' => 'tiny',
  70. 'description' => 'Weight of field in relation to other profile fields.',
  71. ),
  72. 'required' => array(
  73. 'type' => 'int',
  74. 'not null' => TRUE,
  75. 'default' => 0,
  76. 'size' => 'tiny',
  77. 'description' => 'Whether the user is required to enter a value. (0 = no, 1 = yes)',
  78. ),
  79. 'register' => array(
  80. 'type' => 'int',
  81. 'not null' => TRUE,
  82. 'default' => 0,
  83. 'size' => 'tiny',
  84. 'description' => 'Whether the field is visible in the user registration form. (1 = yes, 0 = no)',
  85. ),
  86. 'visibility' => array(
  87. 'type' => 'int',
  88. 'not null' => TRUE,
  89. 'default' => 0,
  90. 'size' => 'tiny',
  91. 'description' => 'The level of visibility for the field. (0 = hidden, 1 = private, 2 = public on profile but not member list pages, 3 = public on profile and list pages)',
  92. ),
  93. 'autocomplete' => array(
  94. 'type' => 'int',
  95. 'not null' => TRUE,
  96. 'default' => 0,
  97. 'size' => 'tiny',
  98. 'description' => 'Whether form auto-completion is enabled. (0 = disabled, 1 = enabled)',
  99. ),
  100. 'options' => array(
  101. 'type' => 'text',
  102. 'not null' => FALSE,
  103. 'description' => 'List of options to be used in a list selection field.',
  104. ),
  105. ),
  106. 'indexes' => array('category' => array('category')),
  107. 'unique keys' => array('name' => array('name')),
  108. 'primary key' => array('fid'),
  109. );
  110. $schema['profile_values'] = array(
  111. 'description' => 'Stores values for profile fields.',
  112. 'fields' => array(
  113. 'fid' => array(
  114. 'type' => 'int',
  115. 'unsigned' => TRUE,
  116. 'not null' => TRUE,
  117. 'default' => 0,
  118. 'description' => 'The {profile_fields}.fid of the field.',
  119. ),
  120. 'uid' => array(
  121. 'type' => 'int',
  122. 'unsigned' => TRUE,
  123. 'not null' => TRUE,
  124. 'default' => 0,
  125. 'description' => 'The {users}.uid of the profile user.',
  126. ),
  127. 'value' => array(
  128. 'type' => 'text',
  129. 'not null' => FALSE,
  130. 'description' => 'The value for the field.',
  131. ),
  132. ),
  133. 'primary key' => array('uid', 'fid'),
  134. 'indexes' => array(
  135. 'fid' => array('fid'),
  136. ),
  137. );
  138. return $schema;
  139. }