[PR #142] [MERGED] fix: add metadata field to repositories table to prevent duplicate issues on sync #149

Closed
opened 2026-02-27 15:55:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/142
Author: @arunavo4
Created: 10/30/2025
Status: Merged
Merged: 10/31/2025
Merged by: @arunavo4

Base: mainHead: fix/issue-141-duplicate-issues-on-sync


📝 Commits (1)

  • d59a07a fix: add metadata field to repositories table to prevent duplicate issues on sync

📊 Changes

4 files changed (+2017 additions, -0 deletions)

View changed files

drizzle/0008_serious_thena.sql (+1 -0)
drizzle/meta/0008_snapshot.json (+2006 -0)
📝 drizzle/meta/_journal.json (+7 -0)
📝 src/lib/db/schema.ts (+3 -0)

📄 Description

Fixes #141

The repository metadata field was missing from the database schema, which caused the metadata sync state (issues, PRs, releases, etc.) to not persist. This resulted in duplicate issues being created every time a repository was synced because the system couldn't track what had already been mirrored.

Changes:

  • Added metadata text field to repositories table in schema
  • Added metadata field to repositorySchema Zod validation
  • Generated database migration 0008_serious_thena.sql

Root cause analysis:

  1. Code tried to read/write repository.metadata to track mirrored components
  2. The metadata field didn't exist in the database schema
  3. On sync, metadataState.components.issues was always false
  4. This triggered re-mirroring of all issues, creating duplicates

The fix ensures metadata state persists between mirrors and syncs, preventing duplicate metadata (issues, PRs, releases) from being created in Gitea.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/142 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 10/30/2025 **Status:** ✅ Merged **Merged:** 10/31/2025 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `fix/issue-141-duplicate-issues-on-sync` --- ### 📝 Commits (1) - [`d59a07a`](https://github.com/RayLabsHQ/gitea-mirror/commit/d59a07a8c5f605fa1cea1f2683beed449cdc030c) fix: add metadata field to repositories table to prevent duplicate issues on sync ### 📊 Changes **4 files changed** (+2017 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `drizzle/0008_serious_thena.sql` (+1 -0) ➕ `drizzle/meta/0008_snapshot.json` (+2006 -0) 📝 `drizzle/meta/_journal.json` (+7 -0) 📝 `src/lib/db/schema.ts` (+3 -0) </details> ### 📄 Description Fixes #141 The repository metadata field was missing from the database schema, which caused the metadata sync state (issues, PRs, releases, etc.) to not persist. This resulted in duplicate issues being created every time a repository was synced because the system couldn't track what had already been mirrored. Changes: - Added metadata text field to repositories table in schema - Added metadata field to repositorySchema Zod validation - Generated database migration 0008_serious_thena.sql Root cause analysis: 1. Code tried to read/write repository.metadata to track mirrored components 2. The metadata field didn't exist in the database schema 3. On sync, metadataState.components.issues was always false 4. This triggered re-mirroring of all issues, creating duplicates The fix ensures metadata state persists between mirrors and syncs, preventing duplicate metadata (issues, PRs, releases) from being created in Gitea. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:55:19 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gitea-mirror#149
No description provided.