modified: backend/src/controllers/databaseManagementController.ts

modified:   backend/src/controllers/dynamicApiController.ts
	modified:   backend/src/controllers/endpointController.ts
	new file:   backend/src/migrations/005_add_aql_support.sql
	new file:   backend/src/services/AqlExecutor.ts
	modified:   backend/src/types/index.ts
	modified:   frontend/src/components/EndpointModal.tsx
	modified:   frontend/src/pages/Databases.tsx
	modified:   frontend/src/types/index.ts
This commit is contained in:
GEgorov
2025-10-07 19:33:50 +03:00
parent 7d8fddfe4f
commit 713e9ba7f7
9 changed files with 793 additions and 147 deletions

View File

@@ -0,0 +1,40 @@
-- Add AQL support to databases table
ALTER TABLE databases
ALTER COLUMN type TYPE VARCHAR(50);
-- Update the type check constraint to include 'aql'
ALTER TABLE databases
DROP CONSTRAINT IF EXISTS databases_type_check;
ALTER TABLE databases
ADD CONSTRAINT databases_type_check
CHECK (type IN ('postgresql', 'mysql', 'mssql', 'aql'));
-- Add AQL-specific columns to databases table
ALTER TABLE databases
ADD COLUMN IF NOT EXISTS aql_base_url TEXT,
ADD COLUMN IF NOT EXISTS aql_auth_type VARCHAR(50) CHECK (aql_auth_type IN ('basic', 'bearer', 'custom')),
ADD COLUMN IF NOT EXISTS aql_auth_value TEXT,
ADD COLUMN IF NOT EXISTS aql_headers JSONB DEFAULT '{}'::jsonb;
-- Add AQL support to endpoints table
ALTER TABLE endpoints
ALTER COLUMN execution_type TYPE VARCHAR(50);
-- Update execution_type check constraint to include 'aql'
ALTER TABLE endpoints
DROP CONSTRAINT IF EXISTS endpoints_execution_type_check;
ALTER TABLE endpoints
ADD CONSTRAINT endpoints_execution_type_check
CHECK (execution_type IN ('sql', 'script', 'aql'));
-- Add AQL-specific columns to endpoints table
ALTER TABLE endpoints
ADD COLUMN IF NOT EXISTS aql_method VARCHAR(10) CHECK (aql_method IN ('GET', 'POST', 'PUT', 'DELETE')),
ADD COLUMN IF NOT EXISTS aql_endpoint TEXT,
ADD COLUMN IF NOT EXISTS aql_body TEXT,
ADD COLUMN IF NOT EXISTS aql_query_params JSONB DEFAULT '{}'::jsonb;
-- Create index for AQL endpoints
CREATE INDEX IF NOT EXISTS idx_endpoints_execution_type ON endpoints(execution_type);