CREATE TABLE `oauth_sessions` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `client_id` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `scope` varchar(255) NOT NULL DEFAULT '', `nonce` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `user_id` int(10) unsigned DEFAULT NULL, `code` varchar(255) CHARACTER SET ascii COLLATE ascii_bin NOT NULL, `code_challenge` varchar(128) NULL, `code_challenge_method` enum('plain', 'S256') NULL, `token_claimed` tinyint(1) NOT NULL DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), `expires` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `code` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ALTER TABLE `oauth_tokens` ADD `session_id` int(10) unsigned NULL, ADD CONSTRAINT `oauth_tokens_session_id` FOREIGN KEY (`session_id`) REFERENCES `oauth_sessions` (`id`), DROP INDEX `code`, DROP INDEX `access_token`, DROP `scope`, DROP `nonce`, DROP `user_id`, DROP `code`, DROP `access_token`;