Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public void delete(String projectId) {
try {
DeleteIndexRequest request = new DeleteIndexRequest(projectId.toLowerCase() + "_node");
DeleteIndexRequest request2 = new DeleteIndexRequest(projectId.toLowerCase() + "_commit");
DeleteIndexRequest request3 = new DeleteIndexRequest(projectId.toLowerCase() + "_metadata");
client.indices().delete(request, RequestOptions.DEFAULT).isAcknowledged();
client.indices().delete(request2, RequestOptions.DEFAULT).isAcknowledged();
client.indices().delete(request3, RequestOptions.DEFAULT).isAcknowledged();
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
43 changes: 42 additions & 1 deletion example/crud.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2467,13 +2467,54 @@
},
"response": []
},
{
"name": "recreate project cc under org a",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"response has project cc\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.projects[0].id).to.eql('cc');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"projects\": [\n\t\t{\n\t\t\t\"id\": \"cc\", \n\t\t\t\"name\": \"cc\",\n\t\t\t\"orgId\": \"a\",\n\t\t\t\"schema\": \"default\"\n\t\t}\n\t]\n}"
},
"url": {
"raw": "{{host}}/projects",
"host": [
"{{host}}"
],
"path": [
"projects"
]
}
},
"response": []
},
{
"name": "create webhook on project aa",
"event": [
{
"listen": "test",
"script": {
"id": "2ba7a873-1bdf-4e86-8329-7069064232a9",
"id": "2ba7a873-1bdf-4e86-8329-7069064232a9",
"exec": [
"pm.test(\"webhook created with returned id\", function () {",
" var jsonData = pm.response.json();",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public boolean createProjectDatabase(Project project) throws SQLException {
public void deleteProjectDatabase(Project project) throws SQLException {
try (Connection connection = crudDataSources.getDataSource(ContextObject.DEFAULT_PROJECT).getConnection();
Statement statement = connection.createStatement()) {
if ("org.postgresql.Driver".equals(env.getProperty("spring.datasource.driver-class-name"))) {
statement.execute(connection.nativeSQL(
"SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '"
+ databaseProjectString(project) + "';"));
}
statement.executeUpdate(connection.nativeSQL("DROP DATABASE " + databaseProjectString(project)));
}
}
Expand Down