cleaned up db schema

This commit is contained in:
Johannes Bülow 2025-07-24 20:54:50 +02:00
parent 4c7f72570e
commit ad191a5393
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
3 changed files with 11 additions and 47 deletions

View file

@ -31,24 +31,6 @@ CREATE TABLE IF NOT EXISTS diec (
data JSONB 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 ( CREATE TABLE IF NOT EXISTS msoffice (
id BIGSERIAL PRIMARY KEY, id BIGSERIAL PRIMARY KEY,
file_id UUID REFERENCES files (id) ON DELETE CASCADE, file_id UUID REFERENCES files (id) ON DELETE CASCADE,

View file

@ -53,24 +53,6 @@ type Msoffice struct {
Macros [][]string 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 { type ProcessingJob struct {
ID int64 ID int64
FileID pgtype.UUID FileID pgtype.UUID

View file

@ -26,8 +26,8 @@ type GetMSOfficeDataRow struct {
Mraptor []byte Mraptor []byte
} }
func (q *Queries) GetMSOfficeData(ctx context.Context, fileID pgtype.UUID) (GetMSOfficeDataRow, error) { func (q *Queries) GetMSOfficeData(ctx context.Context, dollar_1 pgtype.UUID) (GetMSOfficeDataRow, error) {
row := q.db.QueryRow(ctx, getMSOfficeData, fileID) row := q.db.QueryRow(ctx, getMSOfficeData, dollar_1)
var i GetMSOfficeDataRow var i GetMSOfficeDataRow
err := row.Scan( err := row.Scan(
&i.FileID, &i.FileID,
@ -74,12 +74,12 @@ INSERT INTO msoffice_mraptor (
` `
type InsertFileMsofficeMraptorParams struct { type InsertFileMsofficeMraptorParams struct {
FileID pgtype.UUID Column1 pgtype.UUID
Data []byte Column2 []byte
} }
func (q *Queries) InsertFileMsofficeMraptor(ctx context.Context, arg InsertFileMsofficeMraptorParams) error { 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 return err
} }
@ -90,12 +90,12 @@ INSERT INTO msoffice_oleid (
` `
type InsertFileMsofficeOleidParams struct { type InsertFileMsofficeOleidParams struct {
FileID pgtype.UUID Column1 pgtype.UUID
Data []byte Column2 []byte
} }
func (q *Queries) InsertFileMsofficeOleid(ctx context.Context, arg InsertFileMsofficeOleidParams) error { 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 return err
} }
@ -106,12 +106,12 @@ INSERT INTO msoffice_olevba (
` `
type InsertFileMsofficeOlevbaParams struct { type InsertFileMsofficeOlevbaParams struct {
FileID pgtype.UUID Column1 pgtype.UUID
Data []byte Column2 []byte
} }
func (q *Queries) InsertFileMsofficeOlevba(ctx context.Context, arg InsertFileMsofficeOlevbaParams) error { 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 return err
} }