From ad191a5393e5486c4d53cb1c45581d2c914da358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20B=C3=BClow?= Date: Thu, 24 Jul 2025 20:54:50 +0200 Subject: [PATCH] cleaned up db schema --- server/internal/database/schema.sql | 18 ---------------- server/internal/sqlc/models.go | 18 ---------------- server/internal/sqlc/queries-msoffice.sql.go | 22 ++++++++++---------- 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/server/internal/database/schema.sql b/server/internal/database/schema.sql index de47ab1..f0bb2c8 100644 --- a/server/internal/database/schema.sql +++ b/server/internal/database/schema.sql @@ -31,24 +31,6 @@ CREATE TABLE IF NOT EXISTS diec ( data JSONB ); -CREATE TABLE IF NOT EXISTS msoffice_oleid ( - id BIGSERIAL PRIMARY KEY, - file_id UUID REFERENCES files (id) ON DELETE CASCADE, - data JSONB -); - -CREATE TABLE IF NOT EXISTS msoffice_olevba ( - id BIGSERIAL PRIMARY KEY, - file_id UUID REFERENCES files (id) ON DELETE CASCADE, - data JSONB -); - -CREATE TABLE IF NOT EXISTS msoffice_mraptor ( - id BIGSERIAL PRIMARY KEY, - file_id UUID REFERENCES files (id) ON DELETE CASCADE, - data JSONB -); - CREATE TABLE IF NOT EXISTS msoffice ( id BIGSERIAL PRIMARY KEY, file_id UUID REFERENCES files (id) ON DELETE CASCADE, diff --git a/server/internal/sqlc/models.go b/server/internal/sqlc/models.go index ce06ad0..0239a18 100644 --- a/server/internal/sqlc/models.go +++ b/server/internal/sqlc/models.go @@ -53,24 +53,6 @@ type Msoffice struct { Macros [][]string } -type MsofficeMraptor struct { - ID int64 - FileID pgtype.UUID - Data []byte -} - -type MsofficeOleid struct { - ID int64 - FileID pgtype.UUID - Data []byte -} - -type MsofficeOlevba struct { - ID int64 - FileID pgtype.UUID - Data []byte -} - type ProcessingJob struct { ID int64 FileID pgtype.UUID diff --git a/server/internal/sqlc/queries-msoffice.sql.go b/server/internal/sqlc/queries-msoffice.sql.go index 9740a0d..07a7718 100644 --- a/server/internal/sqlc/queries-msoffice.sql.go +++ b/server/internal/sqlc/queries-msoffice.sql.go @@ -26,8 +26,8 @@ type GetMSOfficeDataRow struct { Mraptor []byte } -func (q *Queries) GetMSOfficeData(ctx context.Context, fileID pgtype.UUID) (GetMSOfficeDataRow, error) { - row := q.db.QueryRow(ctx, getMSOfficeData, fileID) +func (q *Queries) GetMSOfficeData(ctx context.Context, dollar_1 pgtype.UUID) (GetMSOfficeDataRow, error) { + row := q.db.QueryRow(ctx, getMSOfficeData, dollar_1) var i GetMSOfficeDataRow err := row.Scan( &i.FileID, @@ -74,12 +74,12 @@ INSERT INTO msoffice_mraptor ( ` type InsertFileMsofficeMraptorParams struct { - FileID pgtype.UUID - Data []byte + Column1 pgtype.UUID + Column2 []byte } func (q *Queries) InsertFileMsofficeMraptor(ctx context.Context, arg InsertFileMsofficeMraptorParams) error { - _, err := q.db.Exec(ctx, insertFileMsofficeMraptor, arg.FileID, arg.Data) + _, err := q.db.Exec(ctx, insertFileMsofficeMraptor, arg.Column1, arg.Column2) return err } @@ -90,12 +90,12 @@ INSERT INTO msoffice_oleid ( ` type InsertFileMsofficeOleidParams struct { - FileID pgtype.UUID - Data []byte + Column1 pgtype.UUID + Column2 []byte } func (q *Queries) InsertFileMsofficeOleid(ctx context.Context, arg InsertFileMsofficeOleidParams) error { - _, err := q.db.Exec(ctx, insertFileMsofficeOleid, arg.FileID, arg.Data) + _, err := q.db.Exec(ctx, insertFileMsofficeOleid, arg.Column1, arg.Column2) return err } @@ -106,12 +106,12 @@ INSERT INTO msoffice_olevba ( ` type InsertFileMsofficeOlevbaParams struct { - FileID pgtype.UUID - Data []byte + Column1 pgtype.UUID + Column2 []byte } func (q *Queries) InsertFileMsofficeOlevba(ctx context.Context, arg InsertFileMsofficeOlevbaParams) error { - _, err := q.db.Exec(ctx, insertFileMsofficeOlevba, arg.FileID, arg.Data) + _, err := q.db.Exec(ctx, insertFileMsofficeOlevba, arg.Column1, arg.Column2) return err }