-
Notifications
You must be signed in to change notification settings - Fork 4
/
social_auth.install
executable file
·120 lines (111 loc) · 2.72 KB
/
social_auth.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* @file
* Install, update and uninstall functions for Social Auth.
*/
use Drupal\Core\Database\Database;
/**
* Add 'social_auth' table when the module is updated from 1.x to 2.x.
*
* Nothing changes if version 2.x is in use.
*/
function social_auth_update_8201() {
$schema = Database::getConnection()->schema();
if (!$schema->tableExists('social_auth')) {
$spec = [
'description' => 'The base table for social_auth entities.',
'fields' => [
'id' => [
'type' => 'serial',
'length' => 10,
'not null' => TRUE,
'unsigned' => TRUE,
],
'uuid' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => FALSE,
],
'user_id' => [
'description' => 'The ID of the target entity.',
'type' => 'int',
'length' => 10,
'not null' => TRUE,
'unsigned' => TRUE,
],
'plugin_id' => [
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'provider_user_id' => [
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
],
'created' => [
'type' => 'int',
'length' => 11,
'not null' => TRUE,
],
'changed' => [
'type' => 'int',
'length' => 11,
'not null' => TRUE,
],
'token' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
],
'additional_data' => [
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
],
],
'primary key' => ['id'],
'unique keys' => ['social_auth_field__uuid__value' => ['uuid']],
'indexes' => ['social_auth_field__user_id__target_id' => ['user_id']],
];
$schema->createTable('social_auth', $spec);
}
}
/**
* Update fields' properties.
*
* The updating fields are uuid, created, changed, token, and additional_data.
*/
function social_auth_update_8202() {
$schema = Database::getConnection()->schema();
$specs = [
'uuid' => [
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
],
'created' => [
'type' => 'int',
'length' => 11,
'not null' => FALSE,
],
'changed' => [
'type' => 'int',
'length' => 11,
'not null' => FALSE,
],
'token' => [
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
],
'additional_data' => [
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
],
];
foreach ($specs as $field => $spec) {
$schema->changeField('social_auth', $field, $field, $spec);
}
}