'SET foreign_key_checks=0;

--
-- Table: `classes`
--
CREATE TABLE `classes` (
  `id` integer NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

--
-- Table: `errors`
--
CREATE TABLE `errors` (
  `code` integer NOT NULL,
  `id` integer NOT NULL auto_increment,
  `message` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
);

--
-- Table: `students`
--
CREATE TABLE `students` (
  `id` bigint NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

--
-- Table: `class_backupclass_student_participants`
--
CREATE TABLE `class_backupclass_student_participants` (
  `backupclass_id` bigint NOT NULL,
  `participant_id` integer NOT NULL,
  INDEX `pk_backupclass_id_participant_id` (`backupclass_id`, `participant_id`),
  PRIMARY KEY (`backupclass_id`, `participant_id`),
  CONSTRAINT `class_backupclass_student_participants_fk` FOREIGN KEY (`backupclass_id`) REFERENCES `classes` (`id`),
  CONSTRAINT `class_backupclass_student_participants_fk_1` FOREIGN KEY (`participant_id`) REFERENCES `students` (`id`)
) ENGINE=InnoDB;

--
-- Table: `class_mainclass_student_participants`
--
CREATE TABLE `class_mainclass_student_participants` (
  `mainclass_id` bigint NOT NULL,
  `participant_id` integer NOT NULL,
  INDEX `pk_mainclass_id_participant_id` (`mainclass_id`, `participant_id`),
  PRIMARY KEY (`mainclass_id`, `participant_id`),
  CONSTRAINT `class_mainclass_student_participants_fk` FOREIGN KEY (`mainclass_id`) REFERENCES `classes` (`id`),
  CONSTRAINT `class_mainclass_student_participants_fk_1` FOREIGN KEY (`participant_id`) REFERENCES `students` (`id`)
) ENGINE=InnoDB;

SET foreign_key_checks=1;'
