user.install

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

File

drupal-6.x/modules/user/user.install
View source
  1. <?php
  2. /**
  3. * Implementation of hook_schema().
  4. */
  5. function user_schema() {
  6. $schema['access'] = array(
  7. 'description' => 'Stores site access rules.',
  8. 'fields' => array(
  9. 'aid' => array(
  10. 'type' => 'serial',
  11. 'not null' => TRUE,
  12. 'description' => 'Primary Key: Unique access ID.',
  13. ),
  14. 'mask' => array(
  15. 'type' => 'varchar',
  16. 'length' => 255,
  17. 'not null' => TRUE,
  18. 'default' => '',
  19. 'description' => 'Text mask used for filtering access.',
  20. ),
  21. 'type' => array(
  22. 'type' => 'varchar',
  23. 'length' => 255,
  24. 'not null' => TRUE,
  25. 'default' => '',
  26. 'description' => 'Type of access rule: name, mail or host.',
  27. ),
  28. 'status' => array(
  29. 'type' => 'int',
  30. 'not null' => TRUE,
  31. 'default' => 0,
  32. 'size' => 'tiny',
  33. 'description' => 'Whether rule is to allow(1) or deny(0) access.',
  34. ),
  35. ),
  36. 'primary key' => array('aid'),
  37. );
  38. $schema['authmap'] = array(
  39. 'description' => 'Stores distributed authentication mapping.',
  40. 'fields' => array(
  41. 'aid' => array(
  42. 'description' => 'Primary Key: Unique authmap ID.',
  43. 'type' => 'serial',
  44. 'unsigned' => TRUE,
  45. 'not null' => TRUE,
  46. ),
  47. 'uid' => array(
  48. 'type' => 'int',
  49. 'not null' => TRUE,
  50. 'default' => 0,
  51. 'description' => "User's {users}.uid.",
  52. ),
  53. 'authname' => array(
  54. 'type' => 'varchar',
  55. 'length' => 128,
  56. 'not null' => TRUE,
  57. 'default' => '',
  58. 'description' => 'Unique authentication name.',
  59. ),
  60. 'module' => array(
  61. 'type' => 'varchar',
  62. 'length' => 128,
  63. 'not null' => TRUE,
  64. 'default' => '',
  65. 'description' => 'Module which is controlling the authentication.',
  66. ),
  67. ),
  68. 'unique keys' => array('authname' => array('authname')),
  69. 'primary key' => array('aid'),
  70. );
  71. $schema['permission'] = array(
  72. 'description' => 'Stores permissions for users.',
  73. 'fields' => array(
  74. 'pid' => array(
  75. 'type' => 'serial',
  76. 'not null' => TRUE,
  77. 'description' => 'Primary Key: Unique permission ID.',
  78. ),
  79. 'rid' => array(
  80. 'type' => 'int',
  81. 'unsigned' => TRUE,
  82. 'not null' => TRUE,
  83. 'default' => 0,
  84. 'description' => 'The {role}.rid to which the permissions are assigned.',
  85. ),
  86. 'perm' => array(
  87. 'type' => 'text',
  88. 'not null' => FALSE,
  89. 'size' => 'big',
  90. 'description' => 'List of permissions being assigned.',
  91. ),
  92. 'tid' => array(
  93. 'type' => 'int',
  94. 'unsigned' => TRUE,
  95. 'not null' => TRUE,
  96. 'default' => 0,
  97. 'description' => 'Originally intended for taxonomy-based permissions, but never used.',
  98. ),
  99. ),
  100. 'primary key' => array('pid'),
  101. 'indexes' => array('rid' => array('rid')),
  102. );
  103. $schema['role'] = array(
  104. 'description' => 'Stores user roles.',
  105. 'fields' => array(
  106. 'rid' => array(
  107. 'type' => 'serial',
  108. 'unsigned' => TRUE,
  109. 'not null' => TRUE,
  110. 'description' => 'Primary Key: Unique role id.',
  111. ),
  112. 'name' => array(
  113. 'type' => 'varchar',
  114. 'length' => 64,
  115. 'not null' => TRUE,
  116. 'default' => '',
  117. 'description' => 'Unique role name.',
  118. ),
  119. ),
  120. 'unique keys' => array('name' => array('name')),
  121. 'primary key' => array('rid'),
  122. );
  123. $schema['users'] = array(
  124. 'description' => 'Stores user data.',
  125. 'fields' => array(
  126. 'uid' => array(
  127. 'type' => 'serial',
  128. 'unsigned' => TRUE,
  129. 'not null' => TRUE,
  130. 'description' => 'Primary Key: Unique user ID.',
  131. ),
  132. 'name' => array(
  133. 'type' => 'varchar',
  134. 'length' => 60,
  135. 'not null' => TRUE,
  136. 'default' => '',
  137. 'description' => 'Unique user name.',
  138. ),
  139. 'pass' => array(
  140. 'type' => 'varchar',
  141. 'length' => 32,
  142. 'not null' => TRUE,
  143. 'default' => '',
  144. 'description' => "User's password (md5 hash).",
  145. ),
  146. 'mail' => array(
  147. 'type' => 'varchar',
  148. 'length' => 64,
  149. 'not null' => FALSE,
  150. 'default' => '',
  151. 'description' => "User's email address.",
  152. ),
  153. 'mode' => array(
  154. 'type' => 'int',
  155. 'not null' => TRUE,
  156. 'default' => 0,
  157. 'size' => 'tiny',
  158. 'description' => 'Per-user comment display mode (threaded vs. flat), used by the {comment} module.',
  159. ),
  160. 'sort' => array(
  161. 'type' => 'int',
  162. 'not null' => FALSE,
  163. 'default' => 0,
  164. 'size' => 'tiny',
  165. 'description' => 'Per-user comment sort order (newest vs. oldest first), used by the {comment} module.',
  166. ),
  167. 'threshold' => array(
  168. 'type' => 'int',
  169. 'not null' => FALSE,
  170. 'default' => 0,
  171. 'size' => 'tiny',
  172. 'description' => 'Previously used by the {comment} module for per-user preferences; no longer used.',
  173. ),
  174. 'theme' => array(
  175. 'type' => 'varchar',
  176. 'length' => 255,
  177. 'not null' => TRUE,
  178. 'default' => '',
  179. 'description' => "User's default theme.",
  180. ),
  181. 'signature' => array(
  182. 'type' => 'varchar',
  183. 'length' => 255,
  184. 'not null' => TRUE,
  185. 'default' => '',
  186. 'description' => "User's signature.",
  187. ),
  188. 'signature_format' => array(
  189. 'type' => 'int',
  190. 'size' => 'small',
  191. 'not null' => TRUE,
  192. 'default' => 0,
  193. 'description' => 'The {filter_formats}.format of the signature.',
  194. ),
  195. 'created' => array(
  196. 'type' => 'int',
  197. 'not null' => TRUE,
  198. 'default' => 0,
  199. 'description' => 'Timestamp for when user was created.',
  200. ),
  201. 'access' => array(
  202. 'type' => 'int',
  203. 'not null' => TRUE,
  204. 'default' => 0,
  205. 'description' => 'Timestamp for previous time user accessed the site.',
  206. ),
  207. 'login' => array(
  208. 'type' => 'int',
  209. 'not null' => TRUE,
  210. 'default' => 0,
  211. 'description' => "Timestamp for user's last login.",
  212. ),
  213. 'status' => array(
  214. 'type' => 'int',
  215. 'not null' => TRUE,
  216. 'default' => 0,
  217. 'size' => 'tiny',
  218. 'description' => 'Whether the user is active(1) or blocked(0).',
  219. ),
  220. 'timezone' => array(
  221. 'type' => 'varchar',
  222. 'length' => 8,
  223. 'not null' => FALSE,
  224. 'description' => "User's timezone.",
  225. ),
  226. 'language' => array(
  227. 'type' => 'varchar',
  228. 'length' => 12,
  229. 'not null' => TRUE,
  230. 'default' => '',
  231. 'description' => "User's default language.",
  232. ),
  233. 'picture' => array(
  234. 'type' => 'varchar',
  235. 'length' => 255,
  236. 'not null' => TRUE,
  237. 'default' => '',
  238. 'description' => "Path to the user's uploaded picture.",
  239. ),
  240. 'init' => array(
  241. 'type' => 'varchar',
  242. 'length' => 64,
  243. 'not null' => FALSE,
  244. 'default' => '',
  245. 'description' => 'Email address used for initial account creation.',
  246. ),
  247. 'data' => array(
  248. 'type' => 'text',
  249. 'not null' => FALSE,
  250. 'size' => 'big',
  251. 'description' => 'A serialized array of name value pairs that are related to the user. Any form values posted during user edit are stored and are loaded into the $user object during user_load(). Use of this field is discouraged and it will likely disappear in a future version of Drupal.',
  252. ),
  253. ),
  254. 'indexes' => array(
  255. 'access' => array('access'),
  256. 'created' => array('created'),
  257. 'mail' => array('mail'),
  258. ),
  259. 'unique keys' => array(
  260. 'name' => array('name'),
  261. ),
  262. 'primary key' => array('uid'),
  263. );
  264. $schema['users_roles'] = array(
  265. 'description' => 'Maps users to roles.',
  266. 'fields' => array(
  267. 'uid' => array(
  268. 'type' => 'int',
  269. 'unsigned' => TRUE,
  270. 'not null' => TRUE,
  271. 'default' => 0,
  272. 'description' => 'Primary Key: {users}.uid for user.',
  273. ),
  274. 'rid' => array(
  275. 'type' => 'int',
  276. 'unsigned' => TRUE,
  277. 'not null' => TRUE,
  278. 'default' => 0,
  279. 'description' => 'Primary Key: {role}.rid for role.',
  280. ),
  281. ),
  282. 'primary key' => array('uid', 'rid'),
  283. 'indexes' => array(
  284. 'rid' => array('rid'),
  285. ),
  286. );
  287. return $schema;
  288. }