fix: Convert big integers to float64
Large numbers can be returned by the Flexpool API reaching the `int64` limit. Blocks reward were seen as 0 ETH. Using `float64` instead. Also converting signed int64 to unsigned int64 for non-timestamp numbers. BREAKING CHANGE: please follow the upgrades instructions from 1.2 to 1.3 to convert such types in the database. Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
ac0903cf9d
commit
3d4c049323
7 changed files with 63 additions and 25 deletions
28
migrations/1.2_to_1.3.sql
Normal file
28
migrations/1.2_to_1.3.sql
Normal file
|
@ -0,0 +1,28 @@
|
|||
-- Migrate from 1.2 to 1.3
|
||||
-- SQLite doesn't support ALTER TABLE... ALTER TYPE
|
||||
-- This migration file creates the new structures with "real" types
|
||||
-- instead of "integer", move data to this new table then drop the old one.
|
||||
|
||||
-- miners
|
||||
|
||||
ALTER TABLE `miners` RENAME TO `miners_old`;
|
||||
|
||||
CREATE TABLE `miners` (
|
||||
`id` integer,
|
||||
`created_at` datetime,
|
||||
`updated_at` datetime,
|
||||
`deleted_at` datetime,
|
||||
`coin` text,
|
||||
`address` text NOT NULL UNIQUE,
|
||||
`balance` real,
|
||||
`last_payment_timestamp` integer,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO `miners` SELECT * FROM `miners_old`;
|
||||
|
||||
DROP TABLE `miners_old`;
|
||||
|
||||
CREATE INDEX `idx_miners_deleted_at` ON `miners`(`deleted_at`);
|
||||
|
||||
SELECT "Database migrated to 1.3"
|
Reference in a new issue