tirbofish/kitgit · commit
a68c1689a44993eb1916eb90a2ef43ee3070d70a
feat: add repository pull mirroring from remotes
Type: SSH
SSH Key Fingerprint:
Verified
SgQHY4vUORbJC3ZtdixCl62ek/4QGh/iG2FRSyjfGPc
@@ -0,0 +1,15 @@ +-- Pull mirrors: fetch from a remote into the local bare repository. +CREATE TABLE IF NOT EXISTS repo_mirrors ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + repo_id UUID NOT NULL UNIQUE REFERENCES repositories(id) ON DELETE CASCADE, + remote_url TEXT NOT NULL, + enabled BOOLEAN NOT NULL DEFAULT TRUE, + last_synced_at TIMESTAMPTZ, + last_error TEXT, + created_by UUID REFERENCES users(id) ON DELETE SET NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), + CONSTRAINT repo_mirrors_remote_url_nonempty CHECK (char_length(trim(remote_url)) > 0) +); +CREATE INDEX IF NOT EXISTS repo_mirrors_enabled_idx + ON repo_mirrors(enabled) WHERE enabled = TRUE; @@ -101,6 +101,19 @@ pub struct BranchRule { pub created_at: DateTime<Utc>, } +#[derive(Debug, Clone, FromRow, Serialize)] +pub struct RepoMirror { + pub id: Uuid, + pub repo_id: Uuid, + pub remote_url: String, + pub enabled: bool, + pub last_synced_at: Option<DateTime<Utc>>, + pub last_error: Option<String>, + pub created_by: Option<Uuid>, + pub created_at: DateTime<Utc>, + pub updated_at: DateTime<Utc>, +} + #[derive(Debug, Clone, FromRow)] pub struct CommentReaction { pub comment_id: Uuid, @@ -2349,3 +2349,82 @@ pub async fn lfs_object_size(pool: &PgPool, oid: &str) -> Result<Option<i64>> {
Large diffs are not rendered by default. Showing the first 50 of 484 lines. Show full diff