-- Auto generated by DBeaver

-- meganjohns.articles definition

CREATE TABLE `articles` (
  `article_id` int(11) NOT NULL AUTO_INCREMENT,
  `article_title` varchar(255) NOT NULL,
  `body` varchar(255) NOT NULL,
  `video_url` varchar(255) DEFAULT NULL,
  `is_featured` tinyint(1) DEFAULT 0,
  PRIMARY KEY (`article_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- meganjohns.artists definition

CREATE TABLE `artists` (
  `artist_id` int(11) NOT NULL AUTO_INCREMENT,
  `artist_name` varchar(255) NOT NULL,
  `artist_url` varchar(255) NOT NULL,
  PRIMARY KEY (`artist_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- meganjohns.medium definition

CREATE TABLE `medium` (
  `medium_id` int(11) NOT NULL AUTO_INCREMENT,
  `medium_name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`medium_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- meganjohns.albums definition

CREATE TABLE `albums` (
  `album_id` int(11) NOT NULL AUTO_INCREMENT,
  `album_name` varchar(255) NOT NULL,
  `year` int(11) NOT NULL,
  `artist_id` int(11) NOT NULL,
  `spotify_url` varchar(255) DEFAULT NULL,
  `itunes_url` varchar(255) DEFAULT NULL,
  `bandcamp_url` varchar(255) DEFAULT NULL,
  `apple_music_url` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`album_id`),
  KEY `artist_id` (`artist_id`),
  CONSTRAINT `albums_ibfk_1` FOREIGN KEY (`artist_id`) REFERENCES `artists` (`artist_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


-- meganjohns.artwork definition

CREATE TABLE `artwork` (
  `artwork_id` int(11) NOT NULL AUTO_INCREMENT,
  `medium_id` int(11) NOT NULL,
  `artwork_name` varchar(255) NOT NULL,
  `source_url` varchar(255) NOT NULL,
  `year` int(11) NOT NULL,
  `size` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`artwork_id`),
  UNIQUE KEY `artwork_name` (`artwork_name`),
  KEY `medium_id` (`medium_id`),
  CONSTRAINT `artwork_ibfk_1` FOREIGN KEY (`medium_id`) REFERENCES `medium` (`medium_id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;