feat(command log): added new log for all commands used
This commit is contained in:
7
database/migrations/0066_nosy_dark_beast.sql
Normal file
7
database/migrations/0066_nosy_dark_beast.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE "commandLog" (
|
||||
"commandLog_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"commandUsed" text NOT NULL,
|
||||
"bodySent" jsonb DEFAULT '[]'::jsonb,
|
||||
"reasonUsed" text,
|
||||
"add_Date" timestamp DEFAULT now()
|
||||
);
|
||||
2159
database/migrations/meta/0066_snapshot.json
Normal file
2159
database/migrations/meta/0066_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -463,6 +463,13 @@
|
||||
"when": 1749492130639,
|
||||
"tag": "0065_nappy_talos",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 66,
|
||||
"version": "7",
|
||||
"when": 1749671243377,
|
||||
"tag": "0066_nosy_dark_beast",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
25
database/schema/commandLog.ts
Normal file
25
database/schema/commandLog.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { text, pgTable, timestamp, uuid, jsonb } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
export const commandLog = pgTable(
|
||||
"commandLog",
|
||||
{
|
||||
commandLog_id: uuid("commandLog_id").defaultRandom().primaryKey(),
|
||||
commandUsed: text("commandUsed").notNull(),
|
||||
bodySent: jsonb("bodySent").default([]),
|
||||
reasonUsed: text("reasonUsed"),
|
||||
add_at: timestamp("add_Date").defaultNow(),
|
||||
},
|
||||
(table) => [
|
||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||
// uniqueIndex("role_name").on(table.name),
|
||||
]
|
||||
);
|
||||
|
||||
// Schema for inserting a user - can be used to validate API requests
|
||||
// export const insertRolesSchema = createInsertSchema(roles, {
|
||||
// name: z.string().min(3, {message: "Role name must be more than 3 letters"}),
|
||||
// });
|
||||
// Schema for selecting a Expenses - can be used to validate API responses
|
||||
export const selectRolesSchema = createSelectSchema(commandLog);
|
||||
Reference in New Issue
Block a user