Preserve dependency metadata during import (#141)

This commit is contained in:
Mark Wotton
2025-10-24 14:34:52 +07:00
committed by GitHub
parent e293974c71
commit dd8327ff2b
2 changed files with 54 additions and 4 deletions

View File

@@ -61,8 +61,12 @@ func (s *SQLiteStorage) AddDependency(ctx context.Context, dep *types.Dependency
}
}
dep.CreatedAt = time.Now()
dep.CreatedBy = actor
if dep.CreatedAt.IsZero() {
dep.CreatedAt = time.Now()
}
if dep.CreatedBy == "" {
dep.CreatedBy = actor
}
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
@@ -191,8 +195,12 @@ func (s *SQLiteStorage) addDependencyUnchecked(ctx context.Context, dep *types.D
// NOTE: We skip parent-child direction validation here because during import/remap,
// we're just updating IDs on existing dependencies that were already validated.
dep.CreatedAt = time.Now()
dep.CreatedBy = actor
if dep.CreatedAt.IsZero() {
dep.CreatedAt = time.Now()
}
if dep.CreatedBy == "" {
dep.CreatedBy = actor
}
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {