feat(db): Add favicon support and improve remote followers uniqueness constraint
- Add favicon_url column to nodes table for storing node instance favicons - Replace actor_url unique constraint with composite unique index on (user_id, actor_url) in remote_followers table - Update database schema and migration files to reflect new constraints - Improve data integrity by ensuring remote followers are unique per user and actor combination
This commit is contained in:
+3
-2
@@ -1,4 +1,4 @@
|
||||
import { pgTable, text, timestamp, uuid, integer, boolean, index, foreignKey } from 'drizzle-orm/pg-core';
|
||||
import { pgTable, text, timestamp, uuid, integer, boolean, index, foreignKey, uniqueIndex } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
|
||||
// ============================================
|
||||
@@ -252,7 +252,7 @@ export const remoteFollows = pgTable('remote_follows', {
|
||||
export const remoteFollowers = pgTable('remote_followers', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
userId: uuid('user_id').notNull().references(() => users.id, { onDelete: 'cascade' }), // Local user being followed
|
||||
actorUrl: text('actor_url').notNull().unique(), // Remote actor URL (unique per local user)
|
||||
actorUrl: text('actor_url').notNull(), // Remote actor URL
|
||||
inboxUrl: text('inbox_url').notNull(), // Remote user's inbox
|
||||
sharedInboxUrl: text('shared_inbox_url'), // Optional shared inbox
|
||||
handle: text('handle'), // Remote user's handle (e.g., user@mastodon.social)
|
||||
@@ -261,6 +261,7 @@ export const remoteFollowers = pgTable('remote_followers', {
|
||||
}, (table) => [
|
||||
index('remote_followers_user_idx').on(table.userId),
|
||||
index('remote_followers_actor_idx').on(table.actorUrl),
|
||||
uniqueIndex('remote_followers_user_actor_unique').on(table.userId, table.actorUrl),
|
||||
]);
|
||||
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user