diff --git a/migrate/20220106162320_create_dao_coin_tables.go b/migrate/20220106162320_create_dao_coin_tables.go index c722bff8e..596b53c78 100644 --- a/migrate/20220106162320_create_dao_coin_tables.go +++ b/migrate/20220106162320_create_dao_coin_tables.go @@ -65,7 +65,7 @@ func init() { down := func(db orm.DB) error { _, err := db.Exec(` DROP TABLE pg_metadata_dao_coins; - DROP TABLE pg_metadata_dao_coin_transfer; + DROP TABLE pg_metadata_dao_coin_transfers; DROP TABLE pg_dao_coin_balances; ALTER TABLE pg_profiles DROP COLUMN minting_disabled, diff --git a/migrate/20220118103134_update_buy_now_nft_splits_and_fix_dao_types.go b/migrate/20220118103134_update_buy_now_nft_splits_and_fix_dao_types.go index 35d802685..ca9aa241c 100644 --- a/migrate/20220118103134_update_buy_now_nft_splits_and_fix_dao_types.go +++ b/migrate/20220118103134_update_buy_now_nft_splits_and_fix_dao_types.go @@ -65,20 +65,20 @@ func init() { down := func(db orm.DB) error { _, err := db.Exec(` ALTER TABLE pg_nfts - DROP COLUMN additional_nft_royalties_to_coins_basis_points, - DROP COLUMN additional_nft_royalties_to_creators_basis_points; - ALTER TABLE pg_posts DROP COLUMN is_buy_now, DROP COLUMN buy_now_price_nanos; + ALTER TABLE pg_posts + DROP COLUMN additional_nft_royalties_to_coins_basis_points, + DROP COLUMN additional_nft_royalties_to_creators_basis_points; ALTER TABLE pg_dao_coin_balances - ALTER COLUMN balance_nanos TYPE BIGINT USING lpad(balance_nanos, 16, '0')::bit(64)::bigint; + ALTER COLUMN balance_nanos TYPE BIGINT USING ('x' || lpad(replace(balance_nanos, '0x', ''), 16, '0'))::bit(64)::bigint; ALTER TABLE pg_metadata_dao_coin_transfers - ALTER COLUMN dao_coin_to_transfer_nanos TYPE BIGINT USING lpad(dao_coin_to_transfer_nanos, 16, '0')::bit(64)::bigint; + ALTER COLUMN dao_coin_to_transfer_nanos TYPE BIGINT USING ('x' || lpad(replace(dao_coin_to_transfer_nanos, '0x', ''), 16, '0'))::bit(64)::bigint; ALTER TABLE pg_metadata_dao_coins - ALTER COLUMN coins_to_mint_nanos TYPE BIGINT USING lpad(coins_to_mint_nanos, 16, '0')::bit(64)::bigint, - ALTER COLUMN coins_to_burn_nanos TYPE BIGINT USING lpad(coins_to_burn_nanos, 16, '0')::bit(64)::bigint; + ALTER COLUMN coins_to_mint_nanos TYPE BIGINT USING ('x' || lpad(replace(coins_to_mint_nanos, '0x', ''), 16, '0'))::bit(64)::bigint, + ALTER COLUMN coins_to_burn_nanos TYPE BIGINT USING ('x' || lpad(replace(coins_to_burn_nanos, '0x', ''), 16, '0'))::bit(64)::bigint; ALTER TABLE pg_profiles - ALTER COLUMN dao_coin_coins_in_circulation_nanos TYPE BIGINT USING lpad(dao_coin_coins_in_circulation_nanos, 16, '0')::bit(64)::bigint; + ALTER COLUMN dao_coin_coins_in_circulation_nanos TYPE BIGINT USING ('x' || lpad(replace(dao_coin_coins_in_circulation_nanos, '0x', ''), 16, '0'))::bit(64)::bigint; `) return err } diff --git a/migrate/init.go b/migrate/init.go index 1736b31e8..56ad553f4 100644 --- a/migrate/init.go +++ b/migrate/init.go @@ -1,11 +1,8 @@ package migrate -import "github.com/golang/glog" - // LoadMigrations forces Go to call init() on all the files in this package. // The library we use for migrations, go-pg-migrations, needs to be refactored to // not use this terrible loading pattern. It's hard to test, can cause weird side effects, // and is the reason we need this weird LoadMigrations method func LoadMigrations() { - glog.Info("Loading all migrations...") }