mirror of
https://github.com/Dvorinka/Trackeep.git
synced 2026-06-03 20:12:58 +00:00
feat: migrate to DragonflyDB and clean up environment configuration
- Replace Redis with DragonflyDB for better performance and memory efficiency - Remove redundant environment variables (POSTGRES_*, ENCRYPTION_KEY, OAUTH_SERVICE_URL) - Consolidate database configuration to use single DB_* variables - Use JWT_SECRET for both JWT tokens and encryption - Remove PORT variable redundancy, use BACKEND_PORT consistently - Clean up docker-compose configurations for dev/prod consistency - Add DragonflyDB configuration with optimized memory usage - Remove redis.conf as it's no longer needed - Update health checks to use Redis-compatible CLI for DragonflyDB - Add missing VITE_API_URL to production frontend - Fix GitHub Actions to use correct go.sum path - Clean up development directories and unused files
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// GitHubAppInstallState stores short-lived install state values for GitHub App callbacks.
|
||||
type GitHubAppInstallState struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||
|
||||
UserID uint `json:"user_id" gorm:"not null;index"`
|
||||
User User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
||||
|
||||
State string `json:"state" gorm:"not null;size:128;uniqueIndex"`
|
||||
ExpiresAt time.Time `json:"expires_at" gorm:"not null;index"`
|
||||
UsedAt *time.Time `json:"used_at"`
|
||||
}
|
||||
|
||||
// GitHubAppInstallation stores GitHub App installation metadata linked to a Trackeep user.
|
||||
type GitHubAppInstallation struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||
|
||||
UserID uint `json:"user_id" gorm:"not null;index"`
|
||||
User User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
||||
|
||||
InstallationID int64 `json:"installation_id" gorm:"not null;uniqueIndex"`
|
||||
AppSlug string `json:"app_slug" gorm:"size:255"`
|
||||
AccountLogin string `json:"account_login" gorm:"size:255"`
|
||||
AccountType string `json:"account_type" gorm:"size:64"`
|
||||
LastValidated *time.Time `json:"last_validated,omitempty"`
|
||||
}
|
||||
|
||||
// GitHubRepoBackup tracks local repository backups created by Trackeep.
|
||||
type GitHubRepoBackup struct {
|
||||
ID uint `json:"id" gorm:"primaryKey"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"-" gorm:"index"`
|
||||
|
||||
UserID uint `json:"user_id" gorm:"not null;index:idx_github_backup_user_repo,unique"`
|
||||
User User `json:"user,omitempty" gorm:"foreignKey:UserID"`
|
||||
|
||||
RepositoryID int64 `json:"repository_id" gorm:"index"`
|
||||
RepositoryName string `json:"repository_name" gorm:"size:255"`
|
||||
RepositoryFullName string `json:"repository_full_name" gorm:"not null;size:255;index:idx_github_backup_user_repo,unique"`
|
||||
DefaultBranch string `json:"default_branch" gorm:"size:255"`
|
||||
CloneURL string `json:"clone_url" gorm:"type:text"`
|
||||
LocalPath string `json:"local_path" gorm:"not null;type:text"`
|
||||
Source string `json:"source" gorm:"not null;size:32"` // oauth or github_app
|
||||
InstallationID *int64 `json:"installation_id,omitempty"`
|
||||
LastBackupAt *time.Time `json:"last_backup_at"`
|
||||
LastBackupStatus string `json:"last_backup_status" gorm:"not null;default:'pending';size:32"` // pending, success, error
|
||||
LastBackupError string `json:"last_backup_error"`
|
||||
LastBackupSize int64 `json:"last_backup_size"`
|
||||
}
|
||||
@@ -63,6 +63,9 @@ func AutoMigrate() {
|
||||
&Integration{},
|
||||
&SyncLog{},
|
||||
&WebhookEvent{},
|
||||
&GitHubAppInstallState{},
|
||||
&GitHubAppInstallation{},
|
||||
&GitHubRepoBackup{},
|
||||
// Analytics models
|
||||
&Analytics{},
|
||||
&ProductivityMetrics{},
|
||||
|
||||
Reference in New Issue
Block a user