-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: schema/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/oauth_registered_consumer (
  oarc_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  oarc_consumer_key VARBINARY(32) NOT NULL,
  oarc_name VARBINARY(128) NOT NULL,
  oarc_user_id INT UNSIGNED NOT NULL,
  oarc_version VARBINARY(32) NOT NULL,
  oarc_callback_url BLOB NOT NULL,
  oarc_callback_is_prefix TINYBLOB DEFAULT NULL,
  oarc_description BLOB NOT NULL,
  oarc_email VARBINARY(255) NOT NULL,
  oarc_email_authenticated BINARY(14) DEFAULT NULL,
  oarc_developer_agreement TINYINT DEFAULT 0 NOT NULL,
  oarc_owner_only TINYINT DEFAULT 0 NOT NULL,
  oarc_wiki VARBINARY(32) NOT NULL,
  oarc_grants BLOB NOT NULL,
  oarc_registration BINARY(14) NOT NULL,
  oarc_secret_key VARBINARY(32) DEFAULT NULL,
  oarc_rsa_key BLOB DEFAULT NULL,
  oarc_restrictions BLOB NOT NULL,
  oarc_stage TINYINT UNSIGNED DEFAULT 0 NOT NULL,
  oarc_stage_timestamp BINARY(14) NOT NULL,
  oarc_deleted TINYINT UNSIGNED DEFAULT 0 NOT NULL,
  oarc_oauth_version TINYINT DEFAULT 1 NOT NULL,
  oarc_oauth2_allowed_grants BLOB DEFAULT NULL,
  oarc_oauth2_is_confidential TINYINT DEFAULT 1 NOT NULL,
  UNIQUE INDEX oarc_consumer_key (oarc_consumer_key),
  UNIQUE INDEX oarc_name_version_user (
    oarc_name, oarc_user_id, oarc_version
  ),
  INDEX oarc_user_id (oarc_user_id),
  INDEX oarc_stage_timestamp (
    oarc_stage, oarc_stage_timestamp
  ),
  PRIMARY KEY(oarc_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/oauth_accepted_consumer (
  oaac_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  oaac_wiki VARBINARY(255) NOT NULL,
  oaac_user_id INT UNSIGNED NOT NULL,
  oaac_consumer_id INT UNSIGNED NOT NULL,
  oaac_access_token VARBINARY(32) NOT NULL,
  oaac_access_secret VARBINARY(32) NOT NULL,
  oaac_grants BLOB NOT NULL,
  oaac_accepted BINARY(14) NOT NULL,
  oaac_oauth_version TINYINT DEFAULT 1 NOT NULL,
  UNIQUE INDEX oaac_access_token (oaac_access_token),
  UNIQUE INDEX oaac_user_consumer_wiki (
    oaac_user_id, oaac_consumer_id, oaac_wiki
  ),
  INDEX oaac_consumer_user (oaac_consumer_id, oaac_user_id),
  INDEX oaac_user_id (oaac_user_id, oaac_id),
  PRIMARY KEY(oaac_id)
) /*$wgDBTableOptions*/;


CREATE TABLE /*_*/oauth2_access_tokens (
  oaat_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
  oaat_identifier VARCHAR(255) NOT NULL,
  oaat_expires VARBINARY(14) NOT NULL,
  oaat_acceptance_id INT UNSIGNED NOT NULL,
  oaat_revoked TINYINT DEFAULT 0 NOT NULL,
  UNIQUE INDEX oaat_identifier (oaat_identifier),
  INDEX oaat_acceptance_id (oaat_acceptance_id),
  PRIMARY KEY(oaat_id)
) /*$wgDBTableOptions*/;
