Storing actor socials, improved Hush profile scraper.

This commit is contained in:
DebaucheryLibrarian
2023-07-23 01:02:18 +02:00
parent 48acabac49
commit ca695db3ba
5 changed files with 68 additions and 14 deletions

View File

@@ -17,7 +17,7 @@ exports.up = async (knex) => {
AS showcased,
releases.effective_date,
releases.created_at,
array_agg(tags.slug) FILTER (WHERE tags.slug IS NOT NULL) AS tags
array_agg(tags.slug ORDER BY tags.priority DESC) FILTER (WHERE tags.slug IS NOT NULL) AS tags
FROM releases
LEFT JOIN releases_tags ON releases_tags.release_id = releases.id
LEFT JOIN tags ON tags.id = releases_tags.tag_id

View File

@@ -0,0 +1,27 @@
exports.up = async (knex) => {
await knex.schema.alterTable('actors_social', (table) => {
table.integer('profile_id')
.references('id')
.inTable('actors_profiles');
table.dropUnique(['url', 'actor_id']);
table.unique(['url', 'actor_id', 'profile_id']);
});
await knex.raw(`
CREATE UNIQUE INDEX actors_social_url_actor_id_null_unique ON actors_social (url, actor_id) WHERE profile_id IS NULL;
`);
};
exports.down = async (knex) => {
await knex.raw(`
DROP INDEX actors_social_url_actor_id_null_unique;
`);
await knex.schema.alterTable('actors_social', (table) => {
table.dropUnique(['url', 'actor_id', 'profile_id']);
table.unique(['url', 'actor_id']);
table.dropColumn('profile_id');
});
};