<commit_before>DROP TABLE IF EXISTS `consumers`;
CREATE TABLE `consumers` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `apiKey` VARCHAR(255) NOT NULL UNIQUE,
  `apiSecret` VARCHAR(255) NOT NULL,
  `description` VARCHAR(255) NULL,
  `systemId` INT NOT NULL REFERENCES `systems`(`id`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `systems`;
CREATE TABLE `systems` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL UNIQUE,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `webhooks`;
CREATE TABLE `webhooks` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `url` VARCHAR(255) NOT NULL,
  `secret` VARCHAR(255) NOT NULL,
  `systemId` INT NOT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `url_and_system` (`url`, `systemId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `issuers`;
CREATE TABLE `issuers` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  `systemId` INT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `slug_and_system` (`slug`, `systemId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `programs`;
CREATE TABLE `programs` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  `issuerId` INT NULL REFERENCES `issuers`(`id`),
  UNIQUE KEY `slug_and_issuer` (`slug`, `issuerId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `badges`;
CREATE TABLE `badges` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `strapline` VARCHAR(140) NULL,
  `earnerDescription` TEXT NOT NULL,
  `consumerDescription` TEXT NOT NULL,
  `issuerUrl` VARCHAR(255),
  `rubricUrl` VARCHAR(255),
  `criteriaUrl` VARCHAR(255) NOT NULL,
  `timeValue` INT,
  `timeUnits` ENUM('minutes', 'hours', 'days', 'weeks'),
  `limit` INT,
  `unique` BOOLEAN NOT NULL DEFAULT FALSE,
  `archived` BOOLEAN NOT NULL DEFAULT FALSE,
  `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `imageId` INT NOT NULL REFERENCES `images`(`id`),
  `programId` INT NULL REFERENCES `programs`(`id`),
  `issuerId` INT NULL REFERENCES `issuers`(`id`),
  `systemId` INT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `slug_and_system` (`slug`, `systemId`),
  UNIQUE KEY `slug_and_issuer` (`slug`, `issuerId`),
  UNIQUE KEY `slug_and_program` (`slug`, `programId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `badgeInstances`;
CREATE TABLE `badgeInstances` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL UNIQUE,<commit_msg>Add schema for claim codes.<commit_after>DROP TABLE IF EXISTS `consumers`;
CREATE TABLE `consumers` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `apiKey` VARCHAR(255) NOT NULL UNIQUE,
  `apiSecret` VARCHAR(255) NOT NULL,
  `description` VARCHAR(255) NULL,
  `systemId` INT NOT NULL REFERENCES `systems`(`id`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `systems`;
CREATE TABLE `systems` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL UNIQUE,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `webhooks`;
CREATE TABLE `webhooks` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `url` VARCHAR(255) NOT NULL,
  `secret` VARCHAR(255) NOT NULL,
  `systemId` INT NOT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `url_and_system` (`url`, `systemId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `issuers`;
CREATE TABLE `issuers` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  `systemId` INT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `slug_and_system` (`slug`, `systemId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `programs`;
CREATE TABLE `programs` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `url` VARCHAR(255) NOT NULL,
  `description` TEXT NULL,
  `email` VARCHAR(255) NULL,
  `imageId` INT NULL REFERENCES `images`(`id`),
  `issuerId` INT NULL REFERENCES `issuers`(`id`),
  UNIQUE KEY `slug_and_issuer` (`slug`, `issuerId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `badges`;
CREATE TABLE `badges` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL,
  `name` VARCHAR(255) NOT NULL,
  `strapline` VARCHAR(140) NULL,
  `earnerDescription` TEXT NOT NULL,
  `consumerDescription` TEXT NOT NULL,
  `issuerUrl` VARCHAR(255),
  `rubricUrl` VARCHAR(255),
  `criteriaUrl` VARCHAR(255) NOT NULL,
  `timeValue` INT,
  `timeUnits` ENUM('minutes', 'hours', 'days', 'weeks'),
  `limit` INT,
  `unique` BOOLEAN NOT NULL DEFAULT FALSE,
  `archived` BOOLEAN NOT NULL DEFAULT FALSE,
  `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `imageId` INT NOT NULL REFERENCES `images`(`id`),
  `programId` INT NULL REFERENCES `programs`(`id`),
  `issuerId` INT NULL REFERENCES `issuers`(`id`),
  `systemId` INT NULL REFERENCES `systems`(`id`),
  UNIQUE KEY `slug_and_system` (`slug`, `systemId`),
  UNIQUE KEY `slug_and_issuer` (`slug`, `issuerId`),
  UNIQUE KEY `slug_and_program` (`slug`, `programId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `claimCodes`;
CREATE TABLE `claimCodes` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `code` VARCHAR(255) NOT NULL,
  `claimed` BOOLEAN NOT NULL DEFAULT FALSE,
  `recipient` VARCHAR(255) NULL,
  `multiuse` BOOLEAN NOT NULL DEFAULT FALSE,
  `badgeId` INT NOT NULL REFERENCES `badges`(`id`),
  UNIQUE KEY `code_and_badge` (`code`, `badgeId`),
  PRIMARY KEY (`id`)
) CHARACTER SET utf8
  ENGINE=InnoDB;

DROP TABLE IF EXISTS `badgeInstances`;
CREATE TABLE `badgeInstances` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `slug` VARCHAR(255) NOT NULL UNIQUE,
{'fraction_non_alphanumeric': 0.13792067307692307, 'fraction_numerical': 0.024489182692307692, 'mean_word_length': 5.013550135501355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6734359', 'n_tokens_mistral': 2777, 'n_tokens_neox': 2569, 'n_words': 763}