MCPcopy Create free account
hub / github.com/subquery/subql / addIdAndBlockRangeAttributes

Function addIdAndBlockRangeAttributes

packages/node-core/src/db/sync-helper.ts:434–446  ·  view source on GitHub ↗
(attributes: ModelAttributes<Model<any, any>, any>)

Source from the content-addressed store, hash-verified

432}
433
434export function addIdAndBlockRangeAttributes(attributes: ModelAttributes<Model<any, any>, any>): void {
435 (attributes.id as ModelAttributeColumnOptions).primaryKey = false;
436 attributes.__id = {
437 type: DataTypes.UUID,
438 defaultValue: DataTypes.UUIDV4,
439 allowNull: false,
440 primaryKey: true,
441 } as ModelAttributeColumnOptions;
442 attributes.__block_range = {
443 type: DataTypes.RANGE(DataTypes.BIGINT),
444 allowNull: false,
445 } as ModelAttributeColumnOptions;
446}
447
448export function addBlockRangeColumnToIndexes(indexes: IndexesOptions[]): void {
449 indexes.forEach((index) => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected