Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 8411b56

Browse files
committed
Fixed issues with incorrect mysql schema in provided example
The example mysql example has missing columns and incorrect column types.
1 parent dd8a7ce commit 8411b56

File tree

1 file changed

+85
-60
lines changed

1 file changed

+85
-60
lines changed

data/oauth2.sql

Lines changed: 85 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,91 @@
1-
CREATE TABLE oauth_auth_codes (
2-
id VARCHAR(100),
3-
user_id INTEGER,
4-
client_id INTEGER,
5-
scopes TEXT NULL,
6-
revoked BOOLEAN,
7-
expires_at TIMESTAMP NULL,
8-
PRIMARY KEY(id)
9-
);
1+
--
2+
-- Table structure for table `oauth_access_tokens`
3+
--
104

11-
CREATE TABLE oauth_access_tokens (
12-
id VARCHAR(100),
13-
user_id VARCHAR(40) NULL,
14-
client_id VARCHAR(40),
15-
name VARCHAR(255) NULL,
16-
scopes TEXT NULL,
17-
revoked BOOLEAN,
18-
created_at TIMESTAMP NULL,
19-
updated_at TIMESTAMP NULL,
20-
expires_at TIMESTAMP NULL,
21-
PRIMARY KEY(id)
22-
);
23-
CREATE INDEX idx1_oauth_access_tokens ON oauth_access_tokens(user_id);
5+
CREATE TABLE `oauth_access_tokens` (
6+
`id` varchar(100) NOT NULL,
7+
`user_id` int(10) unsigned DEFAULT NULL,
8+
`client_id` int(10) unsigned NOT NULL,
9+
`name` varchar(255) DEFAULT NULL,
10+
`scopes` text,
11+
`revoked` tinyint(1) NOT NULL DEFAULT '0',
12+
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
13+
`updated_at` datetime DEFAULT NULL,
14+
`expires_at` datetime NOT NULL,
15+
PRIMARY KEY (`id`),
16+
KEY `IDX_CA42527CA76ED39519EB6921BDA26CCD` (`user_id`,`client_id`),
17+
KEY `IDX_CA42527CA76ED395` (`user_id`),
18+
KEY `IDX_CA42527C19EB6921` (`client_id`)
19+
) ENGINE=InnoDB;
2420

25-
CREATE TABLE oauth_refresh_tokens (
26-
id VARCHAR(100),
27-
access_token_id VARCHAR(100),
28-
revoked BOOLEAN,
29-
expires_at TIMESTAMP NULL,
30-
PRIMARY KEY(id)
31-
);
32-
CREATE INDEX idx1_oauth_refresh_tokens ON oauth_refresh_tokens(access_token_id);
21+
--
22+
-- Table structure for table `oauth_auth_codes`
23+
--
3324

34-
CREATE TABLE oauth_clients (
35-
name VARCHAR(40) NOT NULL,
36-
user_id INTEGER NULL,
37-
secret VARCHAR(100) NULL,
38-
redirect VARCHAR(255),
39-
personal_access_client BOOLEAN,
40-
password_client BOOLEAN,
41-
revoked BOOLEAN,
42-
created_at TIMESTAMP NULL,
43-
updated_at TIMESTAMP NULL,
44-
PRIMARY KEY (name)
45-
);
46-
CREATE INDEX idx1_oauth_clients ON oauth_clients(user_id);
25+
CREATE TABLE `oauth_auth_codes` (
26+
`id` varchar(100) NOT NULL,
27+
`user_id` int(10) unsigned DEFAULT NULL,
28+
`client_id` int(10) unsigned NOT NULL,
29+
`scopes` text,
30+
`revoked` tinyint(1) NOT NULL DEFAULT '0',
31+
`expires_at` datetime DEFAULT NULL,
32+
PRIMARY KEY (`id`),
33+
KEY `IDX_BB493F83A76ED395` (`user_id`),
34+
KEY `IDX_BB493F8319EB6921` (`client_id`)
35+
) ENGINE=InnoDB;
4736

48-
CREATE TABLE oauth_personal_access_clients (
49-
client_id INTEGER,
50-
created_at TIMESTAMP NULL,
51-
updated_at TIMESTAMP NULL
52-
);
53-
CREATE INDEX idx1_oauth_personal_access_clients ON oauth_personal_access_clients(client_id);
37+
--
38+
-- Table structure for table `oauth_clients`
39+
--
5440

55-
CREATE TABLE oauth_users (
56-
username VARCHAR(40) NOT NULL,
57-
password VARCHAR(100) NOT NULL,
58-
first_name VARCHAR(80),
59-
last_name VARCHAR(80),
60-
PRIMARY KEY (username)
61-
);
41+
CREATE TABLE `oauth_clients` (
42+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
43+
`user_id` int(10) unsigned DEFAULT NULL,
44+
`name` varchar(100) NOT NULL,
45+
`secret` varchar(100) DEFAULT NULL,
46+
`redirect` varchar(255) DEFAULT NULL,
47+
`personal_access_client` tinyint(1) DEFAULT NULL,
48+
`password_client` tinyint(1) DEFAULT NULL,
49+
`revoked` tinyint(1) DEFAULT NULL,
50+
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
51+
`updated_at` datetime DEFAULT NULL,
52+
PRIMARY KEY (`id`),
53+
KEY `IDX_13CE81015E237E06A76ED395BDA26CCD` (`name`,`user_id`),
54+
KEY `IDX_13CE8101A76ED395` (`user_id`)
55+
) ENGINE=InnoDB;
6256

63-
CREATE TABLE oauth_scopes (
64-
id VARCHAR(30) NOT NULL,
65-
PRIMARY KEY (id)
66-
);
57+
--
58+
-- Table structure for table `oauth_refresh_tokens`
59+
--
60+
61+
CREATE TABLE `oauth_refresh_tokens` (
62+
`id` varchar(100) NOT NULL,
63+
`access_token_id` varchar(100) NOT NULL,
64+
`revoked` tinyint(1) NOT NULL DEFAULT '0',
65+
`expires_at` datetime NOT NULL,
66+
PRIMARY KEY (`id`),
67+
KEY `IDX_5AB6872CCB2688BDA26CCD` (`access_token_id`)
68+
) ENGINE=InnoDB;
69+
70+
--
71+
-- Table structure for table `oauth_scopes`
72+
--
73+
74+
CREATE TABLE `oauth_scopes` (
75+
`id` varchar(100) NOT NULL,
76+
PRIMARY KEY (`id`)
77+
) ENGINE=InnoDB;
78+
79+
--
80+
-- Table structure for table `oauth_users`
81+
--
82+
83+
CREATE TABLE `oauth_users` (
84+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
85+
`username` varchar(320) NOT NULL,
86+
`password` varchar(100) NOT NULL,
87+
`first_name` varchar(80) DEFAULT NULL,
88+
`last_name` varchar(80) DEFAULT NULL,
89+
PRIMARY KEY (`id`),
90+
UNIQUE KEY `UNIQ_93804FF8F85E0677` (`username`)
91+
) ENGINE=InnoDB;

0 commit comments

Comments
 (0)