Skip to content

Commit 328bee3

Browse files
Cmdvkderme
authored andcommitted
adjust query for jsonb and change warning message
1 parent f058638 commit 328bee3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cardano-db-sync/src/Cardano/DbSync.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,13 @@ runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc
191191

192192
-- if the database has jsonb datatypes and the configuration does not have add_jsonb_to_schema enabled, then warn the user
193193
when (resJsonbInSchema && not isJsonBInSchemaConfig) $ do
194-
liftIO $ logWarning trce "The database has jsonb datatypes, but the configuration does not have add_jsonb_to_schema enabled. The all jsonb datatypes will be put back which can take time."
194+
liftIO $ logWarning trce "Removing jsonb datatypes from the database. This can take time."
195195
liftIO $ runDisableJsonbInSchema syncEnv
196196

197197
-- if the database doesn't have jsonb datatypes and the configuration does have add_jsonb_to_schema enabled, then add jsonb datatypes to the database
198-
when (not resJsonbInSchema && isJsonBInSchemaConfig) $ liftIO $ runEnableJsonbInSchema syncEnv
198+
when (not resJsonbInSchema && isJsonBInSchemaConfig) $ do
199+
liftIO $ logWarning trce "Adding jsonb datatypes to the database. This can take time."
200+
liftIO $ runEnableJsonbInSchema syncEnv
199201
liftIO $ runExtraMigrationsMaybe syncEnv
200202
unless useLedger $ liftIO $ do
201203
logInfo trce "Migrating to a no ledger schema"

cardano-db/src/Cardano/Db/Migration/Extra/JsonbInSchemaQueries.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,35 @@ disableJsonbInSchema ::
6363
disableJsonbInSchema = do
6464
handle exceptHandler $
6565
rawExecute
66-
"ALTER TABLE 'tx_metadata' ALTER COLUMN 'json' TYPE VARCHAR"
66+
"ALTER TABLE tx_metadata ALTER COLUMN json TYPE VARCHAR"
6767
[]
6868
handle exceptHandler $
6969
rawExecute
70-
"ALTER TABLE 'script' ALTER COLUMN 'json' TYPE VARCHAR"
70+
"ALTER TABLE script ALTER COLUMN json TYPE VARCHAR"
7171
[]
7272
handle exceptHandler $
7373
rawExecute
74-
"ALTER TABLE 'datum' ALTER COLUMN 'value' TYPE VARCHAR"
74+
"ALTER TABLE datum ALTER COLUMN value TYPE VARCHAR"
7575
[]
7676
handle exceptHandler $
7777
rawExecute
78-
"ALTER TABLE 'redeemer_data' ALTER COLUMN 'value' TYPE VARCHAR"
78+
"ALTER TABLE redeemer_data ALTER COLUMN value TYPE VARCHAR"
7979
[]
8080
handle exceptHandler $
8181
rawExecute
82-
"ALTER TABLE 'cost_model' ALTER COLUMN 'costs' TYPE VARCHAR"
82+
"ALTER TABLE cost_model ALTER COLUMN costs TYPE VARCHAR"
8383
[]
8484
handle exceptHandler $
8585
rawExecute
86-
"ALTER TABLE 'gov_action_proposal' ALTER COLUMN 'description' TYPE VARCHAR"
86+
"ALTER TABLE gov_action_proposal ALTER COLUMN description TYPE VARCHAR"
8787
[]
8888
handle exceptHandler $
8989
rawExecute
90-
"ALTER TABLE 'off_chain_pool_data' ALTER COLUMN 'json' TYPE VARCHAR"
90+
"ALTER TABLE off_chain_pool_data ALTER COLUMN json TYPE VARCHAR"
9191
[]
9292
handle exceptHandler $
9393
rawExecute
94-
"ALTER TABLE 'off_chain_vote_data' ALTER COLUMN 'json' TYPE VARCHAR"
94+
"ALTER TABLE off_chain_vote_data ALTER COLUMN json TYPE VARCHAR"
9595
[]
9696

9797
queryJsonbInSchemaExists ::

0 commit comments

Comments
 (0)