summaryrefslogtreecommitdiff
path: root/db/schema/integration-log.ts
diff options
context:
space:
mode:
Diffstat (limited to 'db/schema/integration-log.ts')
-rw-r--r--db/schema/integration-log.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/db/schema/integration-log.ts b/db/schema/integration-log.ts
new file mode 100644
index 00000000..d90a36ec
--- /dev/null
+++ b/db/schema/integration-log.ts
@@ -0,0 +1,24 @@
+import { pgTable, text, timestamp, varchar, serial, integer } from 'drizzle-orm/pg-core';
+import { integrations } from './integration';
+
+export const integrationLogTable = pgTable('integration_log', {
+ id: serial("id").primaryKey(),
+ integrationId: integer("integration_id").notNull().references(() => integrations.id),
+ executionTime: timestamp('execution_time').notNull().defaultNow(),
+ status: varchar('status', { length: 50 }).notNull(), // 'success', 'failed', 'timeout', 'pending'
+ responseTime: integer('response_time'), // 응답시간 (ms)
+ errorMessage: text('error_message'), // 에러 메시지
+ httpStatusCode: integer('http_status_code'), // HTTP 상태 코드
+ retryCount: integer('retry_count').default(0), // 재시도 횟수
+ requestMethod: varchar('request_method', { length: 10 }), // GET, POST, PUT, DELETE
+ requestUrl: text('request_url'), // 실제 요청 URL
+ ipAddress: varchar('ip_address', { length: 45 }), // 요청 IP 주소
+ userAgent: text('user_agent'), // User Agent
+ sessionId: varchar('session_id', { length: 100 }), // 세션 ID
+ correlationId: varchar('correlation_id', { length: 100 }), // 상관관계 ID
+ createdAt: timestamp('created_at').notNull().defaultNow(),
+});
+
+// 타입 정의
+export type IntegrationLog = typeof integrationLogTable.$inferSelect;
+export type NewIntegrationLog = typeof integrationLogTable.$inferInsert; \ No newline at end of file