"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.down = down;
exports.up = up;

async function up(knex) {
  return knex.schema.alterTable('image', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('seasonId');
  }).alterTable('seen', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('episodeId');
  }).alterTable('userRating', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('seasonId');
    table.dropForeign('episodeId');
  }).alterTable('watchlist', table => {
    table.dropForeign('mediaItemId');
  }).alterTable('notificationsHistory', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('episodeId');
  }).alterTable('episode', table => {
    table.dropForeign('tvShowId');
    table.dropForeign('seasonId');
  }).alterTable('season', table => {
    table.dropForeign('tvShowId');
  }).alterTable('listItem', table => {
    table.dropForeign('episodeId');
    table.dropForeign('seasonId');
    table.dropForeign('mediaItemId');
    table.dropForeign('listId');
  }).alterTable('list', table => {
    table.dropForeign('userId');
  }).alterTable('mediaItem', table => {
    table.string('audibleCountryCode');
  }).alterTable('list', table => {
    table.foreign('userId').references('id').inTable('user');
  }).alterTable('listItem', table => {
    table.foreign('episodeId').references('id').inTable('episode');
    table.foreign('seasonId').references('id').inTable('season');
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('listId').references('id').inTable('list');
  }).alterTable('season', table => {
    table.foreign('tvShowId').references('id').inTable('mediaItem');
  }).alterTable('episode', table => {
    table.foreign('tvShowId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
  }).alterTable('image', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
  }).alterTable('seen', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('episodeId').references('id').inTable('episode');
  }).alterTable('userRating', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
    table.foreign('episodeId').references('id').inTable('episode');
  }).alterTable('watchlist', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
  }).alterTable('notificationsHistory', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('episodeId').references('id').inTable('episode');
  });
}

async function down(knex) {
  return knex.schema.alterTable('image', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('seasonId');
  }).alterTable('seen', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('episodeId');
  }).alterTable('userRating', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('seasonId');
    table.dropForeign('episodeId');
  }).alterTable('watchlist', table => {
    table.dropForeign('mediaItemId');
  }).alterTable('notificationsHistory', table => {
    table.dropForeign('mediaItemId');
    table.dropForeign('episodeId');
  }).alterTable('episode', table => {
    table.dropForeign('tvShowId');
    table.dropForeign('seasonId');
  }).alterTable('season', table => {
    table.dropForeign('tvShowId');
  }).alterTable('listItem', table => {
    table.dropForeign('episodeId');
    table.dropForeign('seasonId');
    table.dropForeign('mediaItemId');
    table.dropForeign('listId');
  }).alterTable('list', table => {
    table.dropForeign('userId');
  }).alterTable('mediaItem', table => {
    table.dropColumn('audibleCountryCode');
  }).alterTable('list', table => {
    table.foreign('userId').references('id').inTable('user');
  }).alterTable('listItem', table => {
    table.foreign('episodeId').references('id').inTable('episode');
    table.foreign('seasonId').references('id').inTable('season');
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('listId').references('id').inTable('list');
  }).alterTable('season', table => {
    table.foreign('tvShowId').references('id').inTable('mediaItem');
  }).alterTable('episode', table => {
    table.foreign('tvShowId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
  }).alterTable('image', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
  }).alterTable('seen', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('episodeId').references('id').inTable('episode');
  }).alterTable('userRating', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('seasonId').references('id').inTable('season');
    table.foreign('episodeId').references('id').inTable('episode');
  }).alterTable('watchlist', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
  }).alterTable('notificationsHistory', table => {
    table.foreign('mediaItemId').references('id').inTable('mediaItem');
    table.foreign('episodeId').references('id').inTable('episode');
  });
}
//# sourceMappingURL=20220222195700_audibleCountryCode.js.map