username-1.0.x-dev/modules/username_phone/username_phone.install
modules/username_phone/username_phone.install
<?php
/**
* @file
* Install, update and uninstall functions for the username phone module.
*/
/**
* Implements hook_schema().
*/
function username_phone_schema() {
$schema['user__phones'] = [
'description' => 'Stores phone numbers associated with users.',
'fields' => [
'uid' => [
'description' => 'User ID, links to User table.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'phone_number' => [
'description' => 'The phone number of the user.',
'type' => 'varchar',
'length' => 16,
'not null' => TRUE,
'default' => '',
],
'local_number' => [
'description' => 'The masked local number of the user.',
'type' => 'varchar',
'length' => 18,
'not null' => TRUE,
'default' => '',
],
'country_code' => [
'description' => 'The country code of the phone number.',
'type' => 'varchar',
'length' => 3,
'not null' => TRUE,
'default' => '',
],
'country_iso2' => [
'description' => 'The ISO 3166-1 alpha-2 country code.',
'type' => 'varchar',
'length' => 2,
'not null' => TRUE,
'default' => '',
],
'created' => [
'description' => 'The UNIX timestamp when the phone number was created.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => ['uid'],
'indexes' => [
'phone_number' => ['phone_number'],
'country_code' => ['country_code'],
],
'foreign keys' => [
'users' => [
'table' => 'users',
'columns' => ['uid' => 'uid'],
],
],
];
return $schema;
}
