Skip to content

feat: add new log operation types to enum and migration#1590

Merged
Artuomka merged 1 commit into
mainfrom
backend_add_log_operations
Feb 11, 2026
Merged

feat: add new log operation types to enum and migration#1590
Artuomka merged 1 commit into
mainfrom
backend_add_log_operations

Conversation

@Artuomka

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 11, 2026 09:28
@Artuomka Artuomka enabled auto-merge February 11, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new log operation types (importRows and exportRows) to the LogOperationTypeEnum to support logging of CSV import and export operations. The changes include updating the TypeScript enum definition and creating a database migration to add these values to the PostgreSQL enum type.

Changes:

  • Added importRows and exportRows enum values to LogOperationTypeEnum
  • Created a migration to alter the database enum type to include the new values
  • Reformatted the enum file from spaces to tabs (whitespace consistency)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
backend/src/enums/log-operation-type.enum.ts Added two new enum values (importRows, exportRows) and standardized indentation to tabs
backend/src/migrations/1770801552758-AddNewLogOperationTypes.ts Database migration to add new operation types to the tableLogs operationType enum

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" DROP DEFAULT`);
await queryRunner.query(

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The down migration could cause data loss. If any table logs have been created with the new enum values (importRows or exportRows), the type conversion at line 27 will fail because these values don't exist in the old enum. Consider adding a data migration step to either delete or convert these records to a safe value like 'unknown' before attempting the type conversion.

Suggested change
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" DROP DEFAULT`);
await queryRunner.query(
await queryRunner.query(`ALTER TABLE "tableLogs" ALTER COLUMN "operationType" DROP DEFAULT`);
// Ensure there are no values that are invalid for the old enum before casting
await queryRunner.query(
`UPDATE "tableLogs" SET "operationType" = 'unknown' WHERE "operationType" IN ('importRows', 'exportRows')`,
);
await queryRunner.query(

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
importRows = 'importRows',
exportRows = 'exportRows',

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new enum values importRows and exportRows are not being used in the codebase. The ImportCSVInTableUseCase and ExportCSVFromTableUseCase should create log records using these new enum values, similar to how other table operations (addRow, updateRow, deleteRow) create logs. Consider adding logging to these use cases by injecting TableLogsService and creating log records in finally blocks following the established pattern seen in other table use case files.

Copilot uses AI. Check for mistakes.
@Artuomka Artuomka merged commit 841ca65 into main Feb 11, 2026
25 checks passed
@Artuomka Artuomka deleted the backend_add_log_operations branch February 11, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants