diff --git a/package.json b/package.json index 49a7f88..3bd0e57 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "updates": "../../node_modules/npm-check-updates/bin/npm-check-updates -a" }, "dependencies": { + "sqlite3": "^4.1.1", "@arkecosystem/core-container": "^2.6.0-next.9", "@arkecosystem/core-http-utils": "^2.6.0-next.9", "@arkecosystem/core-interfaces": "^2.6.0-next.9", @@ -34,7 +35,6 @@ "bytebuffer": "^5.0.1", "queue": "^6.0.1", "reflect-metadata": "0.1.13", - "sqlite3": "^4.1.0", "typeorm": "^0.2.18" }, "devDependencies": { diff --git a/src/entities/Delegate.ts b/src/entities/Delegate.ts new file mode 100644 index 0000000..6622e02 --- /dev/null +++ b/src/entities/Delegate.ts @@ -0,0 +1,13 @@ +import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; + +@Entity() +export class Delegate extends BaseEntity { + @PrimaryGeneratedColumn() + public id: number; + + @Column("varchar") + public publicKey: string; + + @Column("varchar") + public topRewards: string; +} diff --git a/src/entities/index.ts b/src/entities/index.ts index 662a88b..372dfbc 100644 --- a/src/entities/index.ts +++ b/src/entities/index.ts @@ -1,2 +1,3 @@ export * from "./Statistic"; export * from "./Round"; +export * from "./Delegate"; diff --git a/src/storage.ts b/src/storage.ts index 1fe7e33..1d7ff4e 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -13,7 +13,7 @@ const qp = queue(); qp.concurrency = 1; // Entities -import { Statistic, Round } from "./entities"; +import { Statistic, Round, Delegate } from "./entities"; // Core plugins @@ -41,7 +41,7 @@ export const plugin: Container.IPluginDescriptor = { type: "sqlite", database: dbPath, // Import entities to connection - entities: [Statistic, Round], + entities: [Statistic, Round, Delegate], synchronize: true, });