Merge pull request #20134 from colemanw/searchKitLinks
[civicrm-core.git] / ext / oauth-client / sql / auto_install.sql
1 -- +--------------------------------------------------------------------+
2 -- | Copyright CiviCRM LLC. All rights reserved. |
3 -- | |
4 -- | This work is published under the GNU AGPLv3 license with some |
5 -- | permitted exceptions and without any warranty. For full license |
6 -- | and copyright information, see https://civicrm.org/licensing |
7 -- +--------------------------------------------------------------------+
8 --
9 -- Generated from schema.tpl
10 -- DO NOT EDIT. Generated by CRM_Core_CodeGen
11 --
12
13
14 -- +--------------------------------------------------------------------+
15 -- | Copyright CiviCRM LLC. All rights reserved. |
16 -- | |
17 -- | This work is published under the GNU AGPLv3 license with some |
18 -- | permitted exceptions and without any warranty. For full license |
19 -- | and copyright information, see https://civicrm.org/licensing |
20 -- +--------------------------------------------------------------------+
21 --
22 -- Generated from drop.tpl
23 -- DO NOT EDIT. Generated by CRM_Core_CodeGen
24 --
25 -- /*******************************************************
26 -- *
27 -- * Clean up the exisiting tables
28 -- *
29 -- *******************************************************/
30
31 SET FOREIGN_KEY_CHECKS=0;
32
33 DROP TABLE IF EXISTS `civicrm_oauth_systoken`;
34 DROP TABLE IF EXISTS `civicrm_oauth_client`;
35
36 SET FOREIGN_KEY_CHECKS=1;
37 -- /*******************************************************
38 -- *
39 -- * Create new tables
40 -- *
41 -- *******************************************************/
42
43 -- /*******************************************************
44 -- *
45 -- * civicrm_oauth_client
46 -- *
47 -- *******************************************************/
48 CREATE TABLE `civicrm_oauth_client` (
49
50
51 `id` int unsigned AUTO_INCREMENT COMMENT 'Internal Client ID',
52 `provider` varchar(128) NOT NULL COMMENT 'Provider',
53 `guid` varchar(128) NOT NULL COMMENT 'Client ID',
54 `secret` text COMMENT 'Client Secret',
55 `options` text COMMENT 'Extra override options for the service (JSON)',
56 `is_active` tinyint NOT NULL DEFAULT 1 COMMENT 'Is the client currently enabled?',
57 `created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the client was created.',
58 `modified_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the client was created or modified.'
59 ,
60 PRIMARY KEY (`id`)
61
62 , INDEX `UI_provider`(
63 provider
64 )
65 , INDEX `UI_guid`(
66 guid
67 )
68
69
70 ) ;
71
72 -- /*******************************************************
73 -- *
74 -- * civicrm_oauth_systoken
75 -- *
76 -- *******************************************************/
77 CREATE TABLE `civicrm_oauth_systoken` (
78
79
80 `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Token ID',
81 `tag` varchar(128) COMMENT 'The tag specifies how this token will be used.',
82 `client_id` int unsigned COMMENT 'Client ID',
83 `grant_type` varchar(31) COMMENT 'Ex: authorization_code',
84 `scopes` text COMMENT 'List of scopes addressed by this token',
85 `token_type` varchar(128) COMMENT 'Ex: Bearer or MAC',
86 `access_token` text COMMENT 'Token to present when accessing resources',
87 `expires` int unsigned DEFAULT 0 COMMENT 'Expiration time for the access_token (seconds since epoch)',
88 `refresh_token` text COMMENT 'Token to present when refreshing the access_token',
89 `resource_owner_name` varchar(128) COMMENT 'Identifier for the resource owner. Structure varies by service.',
90 `resource_owner` text COMMENT 'Cached details describing the resource owner',
91 `error` text COMMENT 'List of scopes addressed by this token',
92 `raw` text COMMENT 'The token response data, per AccessToken::jsonSerialize',
93 `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the client was created.',
94 `modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the client was created or modified.'
95 ,
96 PRIMARY KEY (`id`)
97
98 , INDEX `UI_tag`(
99 tag
100 )
101
102 , CONSTRAINT FK_civicrm_oauth_systoken_client_id FOREIGN KEY (`client_id`) REFERENCES `civicrm_oauth_client`(`id`) ON DELETE CASCADE
103 ) ;
104
105