@secondlayer/subgraphs 4.3.4 → 4.3.5
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.
- package/dist/src/index.js +30 -7
- package/dist/src/index.js.map +4 -4
- package/dist/src/runtime/block-processor.js +20 -3
- package/dist/src/runtime/block-processor.js.map +3 -3
- package/dist/src/runtime/catchup.js +20 -3
- package/dist/src/runtime/catchup.js.map +3 -3
- package/dist/src/runtime/context.js +20 -3
- package/dist/src/runtime/context.js.map +3 -3
- package/dist/src/runtime/processor.js +20 -3
- package/dist/src/runtime/processor.js.map +3 -3
- package/dist/src/runtime/reindex.js +20 -3
- package/dist/src/runtime/reindex.js.map +3 -3
- package/dist/src/runtime/reorg.js +20 -3
- package/dist/src/runtime/reorg.js.map +3 -3
- package/dist/src/schema/index.js +30 -7
- package/dist/src/schema/index.js.map +4 -4
- package/dist/src/service.js +20 -3
- package/dist/src/service.js.map +3 -3
- package/dist/src/testing/index.js +20 -3
- package/dist/src/testing/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -41,6 +41,24 @@ function safeIndexName(name) {
|
|
|
41
41
|
const hash = createHash("sha256").update(name).digest("hex").slice(0, 8);
|
|
42
42
|
return `${name.slice(0, MAX_IDENT_BYTES - hash.length - 1)}_${hash}`;
|
|
43
43
|
}
|
|
44
|
+
function emitIndexedColumnIndexDDL(schemaName, tableName, colName, opts) {
|
|
45
|
+
const concurrently = opts?.concurrently ? " CONCURRENTLY" : "";
|
|
46
|
+
const qualified = `${quotePgIdent(schemaName)}.${quotePgIdent(tableName)}`;
|
|
47
|
+
const plain = `idx_${schemaName}_${tableName}_${colName}`;
|
|
48
|
+
const composite = safeIndexName(`idx_${schemaName}_${tableName}_${colName}_id`);
|
|
49
|
+
const col = quotePgIdent(colName);
|
|
50
|
+
const id = quotePgIdent("_id");
|
|
51
|
+
return {
|
|
52
|
+
create: [
|
|
53
|
+
`CREATE INDEX${concurrently} IF NOT EXISTS ${quotePgIdent(plain)} ON ${qualified} (${col})`,
|
|
54
|
+
`CREATE INDEX${concurrently} IF NOT EXISTS ${quotePgIdent(composite)} ON ${qualified} (${col}, ${id})`
|
|
55
|
+
],
|
|
56
|
+
drop: [
|
|
57
|
+
`DROP INDEX${concurrently} IF EXISTS ${quotePgIdent(schemaName)}.${quotePgIdent(plain)}`,
|
|
58
|
+
`DROP INDEX${concurrently} IF EXISTS ${quotePgIdent(schemaName)}.${quotePgIdent(composite)}`
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
44
62
|
function escapeLiteralDefault(value) {
|
|
45
63
|
if (value === null || value === undefined)
|
|
46
64
|
return "NULL";
|
|
@@ -82,8 +100,7 @@ function emitTableDDL(schemaName, tableName, tableDef) {
|
|
|
82
100
|
statements.push(`CREATE INDEX IF NOT EXISTS ${quotePgIdent(`idx_${schemaName}_${tableName}_tx_id`)} ON ${qualifiedName} (_tx_id)`);
|
|
83
101
|
for (const [colName, col] of Object.entries(tableDef.columns)) {
|
|
84
102
|
if (col.indexed) {
|
|
85
|
-
statements.push(
|
|
86
|
-
statements.push(`CREATE INDEX IF NOT EXISTS ${quotePgIdent(safeIndexName(`idx_${schemaName}_${tableName}_${colName}_id`))} ON ${qualifiedName} (${quotePgIdent(colName)}, ${quotePgIdent("_id")})`);
|
|
103
|
+
statements.push(...emitIndexedColumnIndexDDL(schemaName, tableName, colName).create);
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
106
|
for (const [colName, col] of Object.entries(tableDef.columns)) {
|
|
@@ -4120,5 +4137,5 @@ export {
|
|
|
4120
4137
|
handleSubgraphReorg
|
|
4121
4138
|
};
|
|
4122
4139
|
|
|
4123
|
-
//# debugId=
|
|
4140
|
+
//# debugId=4336E4102441242264756E2164756E21
|
|
4124
4141
|
//# sourceMappingURL=reorg.js.map
|