Plug framework export

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-09-04 10:34:21 +02:00
committed by Sacha Al Himdani
parent d47cac911d
commit 9a3c4d3965
9 changed files with 206 additions and 32 deletions

View File

@@ -65,15 +65,13 @@ INSERT INTO framework_exports (
tenant_id,
framework_id,
status,
created_at,
expires_at
created_at
) VALUES (
@id,
@tenant_id,
@framework_id,
@status,
@created_at,
@expires_at
@created_at
)`
args := pgx.StrictNamedArgs{
@@ -130,6 +128,7 @@ SELECT
id,
framework_id,
status,
file_id,
created_at,
started_at,
completed_at

View File

@@ -249,8 +249,6 @@ WHERE %s
`
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment(), cursor.SQLFragment())
fmt.Printf("\n%s\n", q)
args := pgx.NamedArgs{"control_id": controlID}
maps.Copy(args, scope.SQLArguments())
maps.Copy(args, filter.SQLArguments())

View File

@@ -1,6 +1,6 @@
CREATE TYPE framework_export_status AS ENUM (
'pending',
'processing',
'processing',
'completed',
'failed'
);
@@ -16,5 +16,14 @@ CREATE TABLE framework_exports (
completed_at TIMESTAMP WITH TIME ZONE
);
ALTER TABLE framework_exports ADD CONSTRAINT framework_exports_framework_id_fkey
FOREIGN KEY (framework_id)
REFERENCES frameworks(id)
ON UPDATE CASCADE
ON DELETE CASCADE;
ALTER TABLE framework_exports ADD CONSTRAINT framework_exports_file_id_fkey
FOREIGN KEY (file_id)
REFERENCES files(id)
ON UPDATE CASCADE
ON DELETE SET NULL;