File tree 1 file changed +14
-6
lines changed
src/packages/database/postgres
1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -181,9 +181,11 @@ export async function cleanup_old_projects_data(
181
181
numProj += 1 ;
182
182
let delRows = 0 ;
183
183
184
- // Clean up data *on* a given project. For now, remove all site licenses.
184
+ // Clean up data *on* a given project. For now, remove all site licenses, status and last_active .
185
185
await pool . query (
186
- `UPDATE projects SET site_license = NULL WHERE project_id = $1` ,
186
+ `UPDATE projects
187
+ SET site_license = NULL, status = NULL, last_active = NULL, run_quota = NULL
188
+ WHERE project_id = $1` ,
187
189
[ project_id ] ,
188
190
) ;
189
191
@@ -237,17 +239,23 @@ async function delete_associated_project_data(
237
239
L2 : WinstonLogger [ "debug" ] ,
238
240
project_id : string ,
239
241
) : Promise < number > {
242
+ // TODO: two tables reference a project, but become useless.
243
+ // There should be a fallback strategy to move these objects to another project or surface them as being orphaned.
244
+ // tables: cloud_filesystems, compute_servers
245
+
240
246
let total = 0 ;
241
247
// collecting tables, where the primary key is the default (i.e. "id") and
242
248
// the field to check is always called "project_id"
243
249
const tables = [
244
- "public_paths" ,
245
- "project_log" ,
246
- "file_use" ,
250
+ "blobs" ,
247
251
"file_access_log" ,
252
+ "file_use" ,
248
253
"jupyter_api_log" ,
254
+ "mentions" ,
249
255
"openai_chatgpt_log" ,
250
- "blobs" ,
256
+ "project_log" ,
257
+ "public_paths" ,
258
+ "shopping_cart_items" ,
251
259
] as const ;
252
260
253
261
for ( const table of tables ) {
You can’t perform that action at this time.
0 commit comments