CREATE TABLE IF NOT EXISTS titles (
  id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  type varchar(10), /* TV, movie, video games, etc */
  api_id int(10), /* id that's in the api source */
  charactour_id int(10), /* foreign key to bookmovies table */
  title varchar(255),
  description text,
  keywords varchar(500),
  slug varchar(255),
  image varchar(255),
  series varchar(255),
  original_language varchar(255),
  release_date datetime,
  created_at datetime,
  updated_at datetime
);

CREATE TABLE IF NOT EXISTS titles_games (
  title_id int(10),
  storyline text
);

CREATE TABLE IF NOT EXISTS titles_gamedb_genres (
  id int(10) unsigned NOT NULL primary key AUTO_INCREMENT,
  genre varchar(255)
);


CREATE TABLE IF NOT EXISTS titles_gamedb_modes (
  id int(10) unsigned NOT NULL primary key AUTO_INCREMENT,
  mode varchar(255)
);

CREATE TABLE IF NOT EXISTS titles_gamedb_companies (
  id int(10) unsigned NOT NULL primary key AUTO_INCREMENT,
  name varchar(255)
);

CREATE TABLE IF NOT EXISTS titles_gamedb_media (
  title_id int(10),
  media_key varchar(50),
  type varchar(50)
);

CREATE TABLE IF NOT EXISTS titles_gamedb_games_genres (
  title_id int(10),
  genre_id int(10)
);

CREATE TABLE IF NOT EXISTS titles_gamedb_games_modes (
  title_id int(10),
  mode_id int(10)
);

CREATE TABLE IF NOT EXISTS titles_gamedb_games_companies (
  title_id int(10),
  type ENUM('developer', 'publisher'),
  company_id int(10)
);

