@powerhousedao/network-admin 0.0.29 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/workstreams/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,qBAAa,oBAAqB,SAAQ,qBAAqB,CAAC,EAAE,CAAC;WACjD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAKtC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,SAAS,CACtB,OAAO,EAAE,yBAAyB,EAAE,GACnC,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/workstreams/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAEnI,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,qBAAa,oBAAqB,SAAQ,qBAAqB,CAAC,EAAE,CAAC;WACjD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAKtC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,SAAS,CACtB,OAAO,EAAE,yBAAyB,EAAE,GACnC,OAAO,CAAC,IAAI,CAAC;IAwCV,YAAY;IAelB,aAAa,GAAU,QAAQ,yBAAyB,mBA8BvD;IAED,iCAAiC,GAAU,QAAQ,yBAAyB,EAAE,WAAW,uBAAuB,mBA2C/G;IAED,yBAAyB,GAAU,QAAQ,yBAAyB,EAAE,WAAW,uBAAuB,mBAwCvG;IAED,gBAAgB,GAAU,QAAQ,yBAAyB,EAAE,WAAW,uBAAuB,mBAyC9F;CACF"}
|
|
@@ -42,7 +42,21 @@ export class WorkstreamsProcessor extends RelationalDbProcessor {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
async onDisconnect() {
|
|
45
|
+
async onDisconnect() {
|
|
46
|
+
// Clean up all workstreams for this drive's namespace when the drive is deleted
|
|
47
|
+
// Since the database is already namespaced per drive, we delete all rows
|
|
48
|
+
// This ensures no orphaned data remains after drive deletion
|
|
49
|
+
try {
|
|
50
|
+
await this.relationalDb
|
|
51
|
+
.deleteFrom("workstreams")
|
|
52
|
+
.execute();
|
|
53
|
+
console.log(`Cleaned up workstreams for namespace: ${this.namespace}`);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error(`Error cleaning up workstreams for namespace ${this.namespace}:`, error);
|
|
57
|
+
// Don't throw - cleanup errors shouldn't prevent drive deletion
|
|
58
|
+
}
|
|
59
|
+
}
|
|
46
60
|
setWorkstream = async (strand) => {
|
|
47
61
|
const docId = strand.documentId;
|
|
48
62
|
const existingWorkstreamPhids = await this.relationalDb
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/workstreams/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/workstreams/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGrE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsE9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE"}
|
|
@@ -13,23 +13,64 @@ export async function up(db) {
|
|
|
13
13
|
catch (error) {
|
|
14
14
|
// Type might already exist, ignore error
|
|
15
15
|
}
|
|
16
|
-
// Create table
|
|
17
|
-
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
// Create table with IF NOT EXISTS
|
|
17
|
+
try {
|
|
18
|
+
await db.schema
|
|
19
|
+
.createTable("workstreams")
|
|
20
|
+
.addColumn('network_phid', 'varchar(255)')
|
|
21
|
+
.addColumn('network_slug', 'varchar(255)')
|
|
22
|
+
.addColumn("workstream_phid", "varchar(255)")
|
|
23
|
+
.addColumn('workstream_slug', 'varchar(255)')
|
|
24
|
+
.addColumn('workstream_title', 'varchar(255)')
|
|
25
|
+
.addColumn('workstream_status', sql `workstream_status`)
|
|
26
|
+
.addColumn('sow_phid', 'varchar(255)')
|
|
27
|
+
.addColumn('roadmap_oid', 'varchar(255)')
|
|
28
|
+
.addColumn('final_milestone_target', 'timestamp')
|
|
29
|
+
.addColumn('initial_proposal_status', sql `proposal_status`)
|
|
30
|
+
.addColumn('initial_proposal_author', 'varchar(255)')
|
|
31
|
+
.addPrimaryKeyConstraint("workstreams_pkey", ["workstream_phid"])
|
|
32
|
+
.ifNotExists()
|
|
33
|
+
.execute();
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Table might already exist, continue to add missing columns
|
|
37
|
+
}
|
|
38
|
+
// Add missing columns if table already existed (migration upgrade path)
|
|
39
|
+
// Use try-catch since PostgreSQL doesn't support IF NOT EXISTS for ALTER TABLE ADD COLUMN
|
|
40
|
+
const addColumnIfNotExists = async (columnName, columnDef) => {
|
|
41
|
+
try {
|
|
42
|
+
if (typeof columnDef === 'string') {
|
|
43
|
+
await db.schema.alterTable("workstreams").addColumn(columnName, columnDef).execute();
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// For enum types (sql template), use ALTER TABLE with raw SQL
|
|
47
|
+
if (columnName === 'workstream_status') {
|
|
48
|
+
await sql `ALTER TABLE workstreams ADD COLUMN workstream_status workstream_status`.execute(db);
|
|
49
|
+
}
|
|
50
|
+
else if (columnName === 'initial_proposal_status') {
|
|
51
|
+
await sql `ALTER TABLE workstreams ADD COLUMN initial_proposal_status proposal_status`.execute(db);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
// Column already exists (error code 42701) - ignore
|
|
57
|
+
// Other errors might indicate issues, but we continue
|
|
58
|
+
if (error?.code !== '42701' && error?.code !== '42P16') {
|
|
59
|
+
console.warn(`Error adding column ${columnName}:`, error?.message || error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
await addColumnIfNotExists('network_phid', 'varchar(255)');
|
|
64
|
+
await addColumnIfNotExists('network_slug', 'varchar(255)');
|
|
65
|
+
await addColumnIfNotExists('workstream_phid', 'varchar(255)');
|
|
66
|
+
await addColumnIfNotExists('workstream_slug', 'varchar(255)');
|
|
67
|
+
await addColumnIfNotExists('workstream_title', 'varchar(255)');
|
|
68
|
+
await addColumnIfNotExists('workstream_status', sql `workstream_status`);
|
|
69
|
+
await addColumnIfNotExists('sow_phid', 'varchar(255)');
|
|
70
|
+
await addColumnIfNotExists('roadmap_oid', 'varchar(255)');
|
|
71
|
+
await addColumnIfNotExists('final_milestone_target', 'timestamp');
|
|
72
|
+
await addColumnIfNotExists('initial_proposal_status', sql `proposal_status`);
|
|
73
|
+
await addColumnIfNotExists('initial_proposal_author', 'varchar(255)');
|
|
33
74
|
}
|
|
34
75
|
export async function down(db) {
|
|
35
76
|
// drop table
|