Commit | Line | Data |
---|---|---|
c145023a TO |
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 | ||
c145023a TO |
13 | -- +--------------------------------------------------------------------+ |
14 | -- | Copyright CiviCRM LLC. All rights reserved. | | |
15 | -- | | | |
16 | -- | This work is published under the GNU AGPLv3 license with some | | |
17 | -- | permitted exceptions and without any warranty. For full license | | |
18 | -- | and copyright information, see https://civicrm.org/licensing | | |
19 | -- +--------------------------------------------------------------------+ | |
20 | -- | |
21 | -- Generated from drop.tpl | |
22 | -- DO NOT EDIT. Generated by CRM_Core_CodeGen | |
23 | -- | |
24 | -- /******************************************************* | |
25 | -- * | |
d55f710f | 26 | -- * Clean up the existing tables |
c145023a TO |
27 | -- * |
28 | -- *******************************************************/ | |
29 | ||
30 | SET FOREIGN_KEY_CHECKS=0; | |
31 | ||
32 | DROP TABLE IF EXISTS `civicrm_oauth_systoken`; | |
d55f710f | 33 | DROP TABLE IF EXISTS `civicrm_oauth_contact_token`; |
c145023a TO |
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.', | |
d55f710f | 58 | `modified_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the client was created or modified.' |
c145023a TO |
59 | , |
60 | PRIMARY KEY (`id`) | |
d55f710f | 61 | |
c145023a TO |
62 | , INDEX `UI_provider`( |
63 | provider | |
64 | ) | |
65 | , INDEX `UI_guid`( | |
66 | guid | |
67 | ) | |
d55f710f NM |
68 | |
69 | ||
70 | ) ENGINE=InnoDB ; | |
71 | ||
72 | -- /******************************************************* | |
73 | -- * | |
74 | -- * civicrm_oauth_contact_token | |
75 | -- * | |
76 | -- *******************************************************/ | |
77 | CREATE TABLE `civicrm_oauth_contact_token` ( | |
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 | `contact_id` int unsigned COMMENT 'Contact ID', | |
84 | `grant_type` varchar(31) COMMENT 'Ex: authorization_code', | |
85 | `scopes` text COMMENT 'List of scopes addressed by this token', | |
86 | `token_type` varchar(128) COMMENT 'Ex: Bearer or MAC', | |
87 | `access_token` text COMMENT 'Token to present when accessing resources', | |
88 | `expires` int unsigned DEFAULT 0 COMMENT 'Expiration time for the access_token (seconds since epoch)', | |
89 | `refresh_token` text COMMENT 'Token to present when refreshing the access_token', | |
90 | `resource_owner_name` varchar(128) COMMENT 'Identifier for the resource owner. Structure varies by service.', | |
91 | `resource_owner` text COMMENT 'Cached details describing the resource owner', | |
92 | `error` text COMMENT '?? copied from OAuthSysToken', | |
93 | `raw` text COMMENT 'The token response data, per AccessToken::jsonSerialize', | |
94 | `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the token was created.', | |
95 | `modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the token was created or modified.' | |
96 | , | |
97 | PRIMARY KEY (`id`) | |
98 | ||
99 | , INDEX `UI_tag`( | |
100 | tag | |
101 | ) | |
102 | ||
103 | , CONSTRAINT FK_civicrm_oauth_contact_token_client_id FOREIGN KEY (`client_id`) REFERENCES `civicrm_oauth_client`(`id`) ON DELETE CASCADE, CONSTRAINT FK_civicrm_oauth_contact_token_contact_id FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE | |
104 | ) ENGINE=InnoDB ; | |
c145023a TO |
105 | |
106 | -- /******************************************************* | |
107 | -- * | |
108 | -- * civicrm_oauth_systoken | |
109 | -- * | |
110 | -- *******************************************************/ | |
111 | CREATE TABLE `civicrm_oauth_systoken` ( | |
112 | ||
113 | ||
114 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Token ID', | |
115 | `tag` varchar(128) COMMENT 'The tag specifies how this token will be used.', | |
116 | `client_id` int unsigned COMMENT 'Client ID', | |
117 | `grant_type` varchar(31) COMMENT 'Ex: authorization_code', | |
118 | `scopes` text COMMENT 'List of scopes addressed by this token', | |
119 | `token_type` varchar(128) COMMENT 'Ex: Bearer or MAC', | |
120 | `access_token` text COMMENT 'Token to present when accessing resources', | |
121 | `expires` int unsigned DEFAULT 0 COMMENT 'Expiration time for the access_token (seconds since epoch)', | |
122 | `refresh_token` text COMMENT 'Token to present when refreshing the access_token', | |
123 | `resource_owner_name` varchar(128) COMMENT 'Identifier for the resource owner. Structure varies by service.', | |
124 | `resource_owner` text COMMENT 'Cached details describing the resource owner', | |
125 | `error` text COMMENT 'List of scopes addressed by this token', | |
126 | `raw` text COMMENT 'The token response data, per AccessToken::jsonSerialize', | |
87794414 | 127 | `created_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'When the token was created.', |
d55f710f | 128 | `modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When the token was created or modified.' |
c145023a TO |
129 | , |
130 | PRIMARY KEY (`id`) | |
d55f710f | 131 | |
c145023a TO |
132 | , INDEX `UI_tag`( |
133 | tag | |
134 | ) | |
c145023a | 135 | |
d55f710f NM |
136 | , CONSTRAINT FK_civicrm_oauth_systoken_client_id FOREIGN KEY (`client_id`) REFERENCES `civicrm_oauth_client`(`id`) ON DELETE CASCADE |
137 | ) ENGINE=InnoDB ; | |
138 |