Skip to content

refactor: Integrate audit_logs.sql into migration system #204

@Xhristin3

Description

@Xhristin3

Problem Statement

The database/audit_logs.sql file defines the audit_logs table as a standalone SQL file outside the migration directory. It is not part of the versioned migration system. There is no corresponding down migration.

Evidence

database/
  audit_logs.sql          ← standalone, not in migrations/
  schema.sql              ← contains audit_logs inline?
  migrations/
    2026051501_*.sql
    2026061001_*.sql
    2026061001_*.sql      ← two pairs with same counter

Impact

The audit_logs table cannot be created or rolled back via the migration system. It exists outside the migration convention and may be missed when setting up new environments.

Proposed Solution

Create a proper up/down migration pair for audit_logs (counter 2026061501 or next available) with the same content as database/audit_logs.sql. Then remove the standalone file or add a comment pointing to the migration.

Acceptance Criteria

  • Migration pair exists in database/migrations/ directory
  • Up migration creates the audit_logs table with indexes
  • Down migration drops the table (safely, with CASCADE if needed)
  • Standalone audit_logs.sql is either removed or re-pointed to the migration

File Map

  • database/migrations/2026061503_add_audit_logs.up.sql — new
  • database/migrations/2026061503_add_audit_logs.down.sql — new
  • database/audit_logs.sql — update or remove

Labels: refactoring, good first issue
Priority: Medium | Difficulty: Beginner | Estimated Effort: 0.5h


Labels: refactoring,good first issue
Priority: Medium | Difficulty: Beginner | Estimated Effort: 0.5h
Backlog ID: REPO-021

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions