Database Builder

Database Builder · GPT Actions

Backengine API

  • PUT /database/initializeinitDb

    Initialize database

  • POST /database/migratemigrate

    Run database migrations against a SQLite database. When creating entities use IF NOT EXISTS. Do not split SQL statements over multiple lines.

  • POST /database/rollbackrollback

    Rollback the last applied migration

  • POST /database/execute-sqlexecuteSql

    Execute a SQL statement

  • GET /database/schemagetSchema

    Fetch the database schema

  • GET /database/database-urlgetDatabaseUrl

    Fetch the database url

原始 API 定义
{
  "openapi": "3.1.0",
  "info": {
    "title": "Backengine API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://dba.backengine.dev"
    }
  ],
  "components": {
    "schemas": {},
    "securitySchemes": {
      "OAuth2": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://example.com",
            "tokenUrl": "https://example.com",
            "scopes": {}
          }
        }
      }
    }
  },
  "paths": {
    "/database/initialize": {
      "put": {
        "name": "initializeDatabase",
        "description": "Initialize database",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "initDb",
        "x-openai-isConsequential": false,
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/database/migrate": {
      "post": {
        "name": "migrate",
        "description": "Run database migrations against a SQLite database. When creating entities use IF NOT EXISTS. Do not split SQL statements over multiple lines.",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "migrate",
        "x-openai-isConsequential": true,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "SQLite database migration",
                "properties": {
                  "upMigrations": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "A SQLite SQL statement to run against a database"
                    }
                  },
                  "downMigrations": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "description": "A SQLite SQL statement to run against a database"
                    }
                  }
                },
                "required": [
                  "upMigrations",
                  "downMigrations"
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/database/rollback": {
      "post": {
        "name": "rollback",
        "description": "Rollback the last applied migration",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "rollback",
        "x-openai-isConsequential": true,
        "responses": {
          "204": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/database/execute-sql": {
      "post": {
        "name": "Execute SQL",
        "description": "Execute a SQL statement",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "executeSql",
        "x-openai-isConsequential": true,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "SQL Statement",
                "properties": {
                  "sql": {
                    "type": "string"
                  }
                },
                "required": [
                  "sql"
                ]
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/database/schema": {
      "get": {
        "name": "Get Schema",
        "description": "Fetch the database schema",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "getSchema",
        "x-openai-isConsequential": true,
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/database/database-url": {
      "get": {
        "name": "Get Database URL",
        "description": "Fetch the database url",
        "security": [
          {
            "OAuth2": []
          }
        ],
        "operationId": "getDatabaseUrl",
        "x-openai-isConsequential": true,
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "databaseUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}