Skip to content

Commit

Permalink
feat: support inscription transfers (#37)
Browse files Browse the repository at this point in the history
* feat: transfer apply

* test: transfers

* feat: location draft

* feat: history

* feat: json p op

* fix: overwrite data

* fix: automatic genesis current

* fix: normalize location pos

* feat: prometheus http metrics

* refactor: rename to /transfers

* fix: normalization

* fix: switch to new predicate syntax
  • Loading branch information
rafaelcr authored Apr 12, 2023
1 parent 13a8459 commit ebeb805
Show file tree
Hide file tree
Showing 20 changed files with 1,126 additions and 312 deletions.
3 changes: 1 addition & 2 deletions migrations/1676395230930_inscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export function up(pgm: MigrationBuilder): void {
notNull: true,
},
});
pgm.createConstraint('inscriptions', 'inscriptions_genesis_id_unique', 'UNIQUE(genesis_id)');
pgm.createConstraint('inscriptions', 'inscriptions_number_unique', 'UNIQUE(number)');
pgm.createIndex('inscriptions', ['genesis_id']);
pgm.createIndex('inscriptions', ['number']);
pgm.createIndex('inscriptions', ['mime_type']);
}
4 changes: 2 additions & 2 deletions migrations/1677284495299_locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export function up(pgm: MigrationBuilder): void {
);
pgm.createConstraint(
'locations',
'locations_inscription_id_block_hash_unique',
'UNIQUE(inscription_id, block_hash)'
'locations_inscription_id_block_height_unique',
'UNIQUE(inscription_id, block_height)'
);
pgm.createIndex('locations', ['block_height']);
pgm.createIndex('locations', ['block_hash']);
Expand Down
41 changes: 41 additions & 0 deletions migrations/1679686636818_json-contents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('json_contents', {
id: {
type: 'serial',
primaryKey: true,
},
inscription_id: {
type: 'int',
notNull: true,
},
p: {
type: 'text',
notNull: true,
},
op: {
type: 'text',
notNull: true,
},
content: {
type: 'jsonb',
notNull: true,
},
});
pgm.createConstraint(
'json_contents',
'json_contents_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'json_contents',
'json_contents_inscription_id_unique',
'UNIQUE(inscription_id)'
);
pgm.createIndex('json_contents', ['p']);
pgm.createIndex('json_contents', ['op']);
}
Loading

0 comments on commit ebeb805

Please sign in to comment.