Change to floating point numbers for prices and claims

This commit is contained in:
Joseph Ferano 2023-04-21 19:26:02 +07:00
parent d040970e97
commit 40060686a0
2 changed files with 23 additions and 20 deletions

View File

@ -6,19 +6,19 @@ begin
name text not null, name text not null,
description text not null, description text not null,
image text not null, image text not null,
claimAmount integer not null, claimAmount float8 not null,
completionTimeInMins integer not null, completionTimeInMins integer not null,
basePrice integer not null, basePrice float8 not null,
tier_1_price integer not null, tier_1_price float8 not null,
tier_1_claimboost integer not null, tier_1_claimboost float8 not null,
tier_2_price integer not null, tier_2_price float8 not null,
tier_2_claimboost integer not null, tier_2_claimboost float8 not null,
tier_3_price integer not null, tier_3_price float8 not null,
tier_3_claimboost integer not null, tier_3_claimboost float8 not null,
tier_4_price integer not null, tier_4_price float8 not null,
tier_4_claimboost integer not null, tier_4_claimboost float8 not null,
tier_5_price integer not null, tier_5_price float8 not null,
tier_5_claimboost integer not null tier_5_claimboost float8 not null
) on commit drop; ) on commit drop;
create temporary table if not exists stakingSources( create temporary table if not exists stakingSources(
id integer primary key, id integer primary key,
@ -130,6 +130,9 @@ begin
end; end;
$$ language plpgsql; $$ language plpgsql;
-- Needed to load the python3 extension
CREATE EXTENSION plpython3u;
create or replace function download_sheets() create or replace function download_sheets()
returns void as $$ returns void as $$
import requests import requests

View File

@ -18,9 +18,9 @@ create table store_item(
id integer primary key, id integer primary key,
name text not null, name text not null,
description text not null, description text not null,
price integer not null, price float8 not null,
image_name text not null, image_name text not null,
claim_amount integer not null, claim_amount float8 not null,
completion_time_in_mins integer not null completion_time_in_mins integer not null
); );
@ -28,7 +28,7 @@ create table upgrade_item(
tier integer not null, tier integer not null,
store_item_id integer not null, store_item_id integer not null,
price text not null, price text not null,
claim_boost integer not null, claim_boost float8 not null,
constraint fk_store_item_upgrade_item foreign key(store_item_id) constraint fk_store_item_upgrade_item foreign key(store_item_id)
references store_item(id) on delete cascade, references store_item(id) on delete cascade,
primary key (store_item_id, tier) primary key (store_item_id, tier)
@ -57,7 +57,7 @@ create table resource_well (
id uuid primary key default gen_random_uuid(), id uuid primary key default gen_random_uuid(),
resource_id integer not null, resource_id integer not null,
source_id uuid not null, source_id uuid not null,
supply integer not null, supply float8 not null,
constraint fk_sid_resource_well foreign key(source_id) constraint fk_sid_resource_well foreign key(source_id)
references staking_source(id) on delete cascade, references staking_source(id) on delete cascade,
constraint fk_rid_resource_well foreign key(resource_id) constraint fk_rid_resource_well foreign key(resource_id)
@ -91,7 +91,7 @@ create table staking_event (
well_id uuid not null, well_id uuid not null,
inventory_item_id uuid not null, inventory_item_id uuid not null,
duration_in_mins integer not null, duration_in_mins integer not null,
stake_amount integer not null, stake_amount float8 not null,
created_at timestamp with time zone default timezone('utc', now()), created_at timestamp with time zone default timezone('utc', now()),
constraint fk_user_staking_event foreign key(user_id) constraint fk_user_staking_event foreign key(user_id)
references users(id) on delete cascade, references users(id) on delete cascade,
@ -104,7 +104,7 @@ create table staking_event (
create table claim_event ( create table claim_event (
id uuid primary key default gen_random_uuid(), id uuid primary key default gen_random_uuid(),
staking_event_id uuid not null, staking_event_id uuid not null,
claim_amount integer not null, claim_amount float8 not null,
created_at timestamp with time zone default timezone('utc', now()), created_at timestamp with time zone default timezone('utc', now()),
constraint fk_se_claim_event foreign key(staking_event_id) constraint fk_se_claim_event foreign key(staking_event_id)
references staking_event(id) on delete cascade references staking_event(id) on delete cascade
@ -113,7 +113,7 @@ create table claim_event (
create table bank_account ( create table bank_account (
id uuid primary key default gen_random_uuid(), id uuid primary key default gen_random_uuid(),
user_id uuid not null, user_id uuid not null,
balance integer not null default 0 check (balance >= 0), balance float8 not null default 0 check (balance >= 0),
constraint fk_user_bank_account foreign key(user_id) constraint fk_user_bank_account foreign key(user_id)
references users(id) on delete cascade references users(id) on delete cascade
); );
@ -122,7 +122,7 @@ create table resource_account (
id uuid primary key default gen_random_uuid(), id uuid primary key default gen_random_uuid(),
resource_id integer not null, resource_id integer not null,
user_id uuid not null, user_id uuid not null,
balance integer not null default 0 check (balance >= 0), balance float8 not null default 0 check (balance >= 0),
constraint fk_user_resource_account foreign key(user_id) constraint fk_user_resource_account foreign key(user_id)
references users(id) on delete cascade, references users(id) on delete cascade,
constraint fk_rid_resource_account foreign key(resource_id) constraint fk_rid_resource_account foreign key(resource_id)