Moved movies to separate table.

This commit is contained in:
DebaucheryLibrarian 2020-07-25 03:44:19 +02:00
parent bfd54e94e7
commit 6c5a62353c
9 changed files with 93 additions and 74 deletions

View File

@ -46,6 +46,20 @@
</router-link> </router-link>
</li> </li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/movies"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Movies</a>
</router-link>
</li>
<li class="nav-item"> <li class="nav-item">
<router-link <router-link
v-slot="{ href, isActive, navigate }" v-slot="{ href, isActive, navigate }"

View File

@ -0,0 +1,11 @@
<template>
<div class="movies">
<h1 class="heading">Movies</h1>
</div>
</template>
<style lang="scss">
.movies {
padding: 1rem;
}
</style>

View File

@ -73,6 +73,21 @@
</router-link> </router-link>
</li> </li>
<li class="nav-item">
<router-link
v-slot="{ href, isActive, navigate }"
to="/movies"
@click.native="toggleSidebar(false)"
>
<a
class="nav-link"
:href="href"
:class="{ active: isActive }"
@click="navigate"
>Movies</a>
</router-link>
</li>
<li class="nav-item"> <li class="nav-item">
<router-link <router-link
v-slot="{ href, isActive, navigate }" v-slot="{ href, isActive, navigate }"

View File

@ -159,11 +159,6 @@ export default {
} }
.heading { .heading {
display: inline-block;
color: var(--primary);
padding: 0 .5rem;
margin: .5rem 0 1rem 0;
font-size: 1.2rem;
text-transform: capitalize; text-transform: capitalize;
} }

View File

@ -175,7 +175,6 @@ const releaseFields = `
date date
datePrecision datePrecision
slug slug
type
shootId shootId
productionDate productionDate
comment comment
@ -218,18 +217,6 @@ const releasesFragment = `
) { ) {
releases: nodes { releases: nodes {
${releaseFields} ${releaseFields}
movieActors: movieActorsByMovieId(orderBy: ACTOR_BY_ACTOR_ID__GENDER_ASC) {
actor {
${actorFields}
}
}
movieTags: movieTagsByMovieId(orderBy: TAG_BY_TAG_ID__PRIORITY_DESC) {
tag {
id
name
slug
}
}
} }
totalCount totalCount
} }
@ -256,37 +243,6 @@ const releaseFragment = `
${releaseTrailerFragment} ${releaseTrailerFragment}
${releaseTeaserFragment} ${releaseTeaserFragment}
${siteFragment} ${siteFragment}
movieActors: movieActorsByMovieId(orderBy: ACTOR_BY_ACTOR_ID__GENDER_ASC) {
actor {
${actorFields}
}
}
movieTags: movieTagsByMovieId(orderBy: TAG_BY_TAG_ID__PRIORITY_DESC) {
tag {
id
name
slug
}
}
movies: releasesMoviesBySceneId {
movie {
id
title
date
slug
createdAt
url
${releaseCoversFragment}
${siteFragment}
actors: movieActorsByMovieId {
actor {
id
name
slug
}
}
}
}
scenes: releasesMoviesByMovieId { scenes: releasesMoviesByMovieId {
scene { scene {
${releaseFields} ${releaseFields}

View File

@ -7,6 +7,7 @@ import Entity from '../components/entities/entity.vue';
import Networks from '../components/networks/networks.vue'; import Networks from '../components/networks/networks.vue';
import Actor from '../components/actors/actor.vue'; import Actor from '../components/actors/actor.vue';
import Actors from '../components/actors/actors.vue'; import Actors from '../components/actors/actors.vue';
import Movies from '../components/movies/movies.vue';
import Tag from '../components/tags/tag.vue'; import Tag from '../components/tags/tag.vue';
import Tags from '../components/tags/tags.vue'; import Tags from '../components/tags/tags.vue';
import Search from '../components/search/search.vue'; import Search from '../components/search/search.vue';
@ -155,6 +156,11 @@ const routes = [
component: Networks, component: Networks,
name: 'networks', name: 'networks',
}, },
{
path: '/movies',
component: Movies,
name: 'movies',
},
{ {
path: '/tags', path: '/tags',
component: Tags, component: Tags,

View File

@ -600,6 +600,49 @@ exports.up = knex => Promise.resolve()
table.datetime('created_at') table.datetime('created_at')
.defaultTo(knex.fn.now()); .defaultTo(knex.fn.now());
})) }))
.then(() => knex.schema.createTable('movies', (table) => {
table.increments('id', 16);
table.integer('entity_id', 12)
.references('id')
.inTable('entities')
.notNullable();
table.integer('studio_id', 12)
.references('id')
.inTable('entities');
table.text('entry_id');
table.unique(['entity_id', 'entry_id']);
table.text('url', 1000);
table.text('title');
table.text('slug');
table.timestamp('date');
table.index('date');
table.enum('date_precision', ['year', 'month', 'day', 'hour', 'minute', 'second'])
.defaultTo('day');
table.text('description');
table.boolean('deep');
table.text('deep_url', 1000);
table.text('comment');
table.integer('created_batch_id', 12)
.references('id')
.inTable('batches');
table.integer('updated_batch_id', 12)
.references('id')
.inTable('batches');
table.datetime('created_at')
.defaultTo(knex.fn.now());
}))
.then(() => knex.schema.createTable('releases', (table) => { .then(() => knex.schema.createTable('releases', (table) => {
table.increments('id', 16); table.increments('id', 16);
@ -612,12 +655,9 @@ exports.up = knex => Promise.resolve()
.references('id') .references('id')
.inTable('entities'); .inTable('entities');
table.text('type', 10)
.defaultTo('scene');
table.text('shoot_id'); table.text('shoot_id');
table.text('entry_id'); table.text('entry_id');
table.unique(['entity_id', 'entry_id', 'type']); table.unique(['entity_id', 'entry_id']);
table.text('url', 1000); table.text('url', 1000);
table.text('title'); table.text('title');
@ -672,7 +712,7 @@ exports.up = knex => Promise.resolve()
table.integer('movie_id', 16) table.integer('movie_id', 16)
.notNullable() .notNullable()
.references('id') .references('id')
.inTable('releases'); .inTable('movies');
table.integer('scene_id', 16) table.integer('scene_id', 16)
.notNullable() .notNullable()
@ -902,21 +942,6 @@ exports.up = knex => Promise.resolve()
.then(() => { // eslint-disable-line arrow-body-style .then(() => { // eslint-disable-line arrow-body-style
// allow vim fold // allow vim fold
return knex.raw(` return knex.raw(`
CREATE VIEW movie_actors AS
SELECT releases_movies.movie_id, releases_actors.actor_id FROM releases_movies
LEFT JOIN releases ON releases.id = releases_movies.scene_id
LEFT JOIN releases_actors ON releases_actors.release_id = releases.id
GROUP BY movie_id, actor_id;
CREATE VIEW movie_tags AS
SELECT releases_movies.movie_id, releases_tags.tag_id FROM releases_movies
LEFT JOIN releases ON releases.id = releases_movies.scene_id
LEFT JOIN releases_tags ON releases_tags.release_id = releases.id
GROUP BY movie_id, tag_id;
COMMENT ON VIEW movie_actors IS E'@foreignKey (movie_id) references releases (id)\n@foreignKey (actor_id) references actors (id)';
COMMENT ON VIEW movie_tags IS E'@foreignKey (movie_id) references releases (id)\n@foreignKey (tag_id) references tags (id)';
COMMENT ON COLUMN actors.height IS E'@omit read,update,create,delete,all,many'; COMMENT ON COLUMN actors.height IS E'@omit read,update,create,delete,all,many';
COMMENT ON COLUMN actors.weight IS E'@omit read,update,create,delete,all,many'; COMMENT ON COLUMN actors.weight IS E'@omit read,update,create,delete,all,many';
@ -929,9 +954,6 @@ exports.up = knex => Promise.resolve()
exports.down = (knex) => { // eslint-disable-line arrow-body-style exports.down = (knex) => { // eslint-disable-line arrow-body-style
// allow vim fold // allow vim fold
return knex.raw(` return knex.raw(`
DROP VIEW IF EXISTS movie_actors;
DROP VIEW IF EXISTS movie_tags;
DROP TABLE IF EXISTS releases_actors CASCADE; DROP TABLE IF EXISTS releases_actors CASCADE;
DROP TABLE IF EXISTS releases_movies CASCADE; DROP TABLE IF EXISTS releases_movies CASCADE;
DROP TABLE IF EXISTS releases_directors CASCADE; DROP TABLE IF EXISTS releases_directors CASCADE;
@ -960,6 +982,7 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP TABLE IF EXISTS networks_social CASCADE; DROP TABLE IF EXISTS networks_social CASCADE;
DROP TABLE IF EXISTS tags_posters CASCADE; DROP TABLE IF EXISTS tags_posters CASCADE;
DROP TABLE IF EXISTS tags_photos CASCADE; DROP TABLE IF EXISTS tags_photos CASCADE;
DROP TABLE IF EXISTS movies CASCADE;
DROP TABLE IF EXISTS releases CASCADE; DROP TABLE IF EXISTS releases CASCADE;
DROP TABLE IF EXISTS actors CASCADE; DROP TABLE IF EXISTS actors CASCADE;
DROP TABLE IF EXISTS directors CASCADE; DROP TABLE IF EXISTS directors CASCADE;

View File

@ -736,7 +736,7 @@ const tagPhotos = [
['cum-in-mouth', 0, 'Vina Sky and Avi Love for HardX'], ['cum-in-mouth', 0, 'Vina Sky and Avi Love for HardX'],
] ]
.map(([slug, fileIndex, comment], index) => ({ .map(([slug, fileIndex, comment], index) => ({
id: nanoid(), id: `${slug}-${fileIndex}`,
tagSlug: slug, tagSlug: slug,
path: `tags/${slug}/${fileIndex}.jpeg`, path: `tags/${slug}/${fileIndex}.jpeg`,
thumbnail: `tags/${slug}/thumbs/${fileIndex}.jpeg`, thumbnail: `tags/${slug}/thumbs/${fileIndex}.jpeg`,

View File

@ -36,7 +36,6 @@ function curateReleaseEntry(release, batchId, existingRelease) {
slug, slug,
description: release.description, description: release.description,
duration: release.duration, duration: release.duration,
type: release.type,
comment: release.comment, comment: release.comment,
// director: release.director, // director: release.director,
// likes: release.rating && release.rating.likes, // likes: release.rating && release.rating.likes,