Files
homebrewery-oidc/server/storage/postgres/migrations/0002_git_backend.js
T
dev-bot BotandClaude Sonnet 5.5 448c67912f
CI / App (npm ci + Build, ESLint, Stylelint, Jest) (push) Successful in 3m25s
CI / Storage (mongo) (push) Successful in 1m24s
CI / Storage (postgres) (push) Successful in 1m13s
Image / Image bauen und pushen (push) Successful in 1m3s
feat(git): Git-Backend über HTTPS + PAT (ADR 0003, FLW-86) (#19)
Repositories gitConnections/brewGitLinks (Mongo/PG), Krypto, SSRF-Policy mit net.BlockList, git-Client ohne Arbeitskopie, Sync/Konflikte, /api/git/*, Client (Verbindungen, Git-Status, Konfliktdialog), Autosave 60 s für Git-Brews (F6), Tests und Doku.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Dev (Paperclip) <dev-bot@noreply.git.morlana.online>
2026-11-25 21:16:42 +00:00

40 lines
1.4 KiB
JavaScript

import { sql } from 'kysely';
// ADR 0003 §2: Git-Verbindungen (pro Benutzer) und Brew-Verknüpfungen.
export const up = async (db)=>{
await sql`
CREATE TABLE git_connections (
id uuid PRIMARY KEY DEFAULT uuidv7(),
owner_user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
label text NOT NULL,
repo_url text NOT NULL,
auth_username text NOT NULL DEFAULT 'git',
token_enc text NOT NULL,
default_branch text NOT NULL DEFAULT 'main',
brew_dir text NOT NULL DEFAULT 'brews',
assets_dir text NOT NULL DEFAULT 'assets',
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
last_verified_at timestamptz
)`.execute(db);
await sql`CREATE INDEX git_connections_owner ON git_connections (owner_user_id)`.execute(db);
await sql`
CREATE TABLE brew_git_links (
brew_id uuid PRIMARY KEY REFERENCES brews(id) ON DELETE CASCADE,
connection_id uuid NOT NULL REFERENCES git_connections(id) ON DELETE CASCADE,
branch text NOT NULL,
path text NOT NULL,
last_commit_sha text,
last_blob_sha text,
last_synced_at timestamptz,
last_error text,
UNIQUE (connection_id, branch, path)
)`.execute(db);
};
export const down = async (db)=>{
await sql`DROP TABLE IF EXISTS brew_git_links`.execute(db);
await sql`DROP TABLE IF EXISTS git_connections`.execute(db);
};