Skip to content

Commit

Permalink
Remove the data column from the asset_pricing table. (#572)
Browse files Browse the repository at this point in the history
* flyway drop asset_pricing data column

* remove data property

* add change log entry
  • Loading branch information
nullpointer0x00 authored Oct 29, 2024
1 parent 4ba09e3 commit 54bef14
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Updates to asset pricing table will set data column to null [#562](https://github.com/provenance-io/explorer-service/pull/562)
* Remove `running_count` and `total_count` columns from the `missed_blocks` table [#549](https://github.com/provenance-io/explorer-service/issues/549)
* Remove `spotlight_cache` table [#559](https://github.com/provenance-io/explorer-service/pull/559)
* Remove the `data` column from the `asset_pricing` table [#563](https://github.com/provenance-io/explorer-service/issues/563)

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT 'Remove asset pricing data column' AS comment;

ALTER TABLE asset_pricing
DROP COLUMN IF EXISTS data;
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import io.provenance.explorer.domain.core.sql.jsonb
import io.provenance.explorer.domain.core.sql.nullsLast
import io.provenance.explorer.domain.core.sql.toDbQueryList
import io.provenance.explorer.domain.extensions.execAndMap
import io.provenance.explorer.domain.models.explorer.AssetPricing
import io.provenance.explorer.domain.models.explorer.TokenDistributionPaginatedResults
import io.provenance.explorer.domain.models.explorer.toCoinStrWithPrice
import io.provenance.explorer.model.AssetHolder
Expand Down Expand Up @@ -219,7 +218,6 @@ object AssetPricingTable : IdTable<Int>(name = "asset_pricing") {
val pricing = decimal("pricing", 100, 50)
val pricingDenom = varchar("pricing_denom", 256)
val lastUpdated = datetime("last_updated")
val data = jsonb<AssetPricingTable, AssetPricing>("data", OBJECT_MAPPER).nullable()
}

class AssetPricingRecord(id: EntityID<Int>) : IntEntity(id) {
Expand All @@ -237,7 +235,6 @@ class AssetPricingRecord(id: EntityID<Int>) : IntEntity(id) {
findUnique(markerDenom, pricingDenom)?.apply {
this.pricing = pricingAmount
this.lastUpdated = timestamp
this.data = null
} ?: AssetPricingTable.insert {
it[this.markerId] = markerId
it[this.markerAddress] = markerAddress ?: ""
Expand All @@ -263,7 +260,6 @@ class AssetPricingRecord(id: EntityID<Int>) : IntEntity(id) {
var pricing by AssetPricingTable.pricing
var pricingDenom by AssetPricingTable.pricingDenom
var lastUpdated by AssetPricingTable.lastUpdated
var data by AssetPricingTable.data
}

object MarkerUnitTable : IntIdTable(name = "marker_unit") {
Expand Down

0 comments on commit 54bef14

Please sign in to comment.