-
Notifications
You must be signed in to change notification settings - Fork 979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop TxMeta column from TxHistory table #4230
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can reflect on the table structure directly and check to see if it has a given column. For example in sqlite it's something like this:
SELECT EXISTS (
SELECT 1
FROM pragma_table_info('txhistory')
WHERE name = 'txmeta'
);
and for postgres I think it's something like this:
SELECT EXISTS (
SELECT 1
FROM information_schema.columns
WHERE
table_name = 'txhistory' AND
column_name = 'txmeta'
);
f03ed8c
to
dae5745
Compare
Done |
dae5745
to
60e08ce
Compare
src/main/ApplicationImpl.cpp
Outdated
@@ -709,6 +709,8 @@ ApplicationImpl::validateAndLogConfig() | |||
{ | |||
if (mConfig.isUsingBucketListDB()) | |||
{ | |||
// Tx meta column no longer supported in BucketListDB | |||
mPersistentState->dropTxMetaIfExists(*mDatabase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to make this schema change in the same place than other schema changes so that people can run the upgrade-db
(some people don't give the account that runs core sql access to update schema)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
60e08ce
to
31dabd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
r+ 31dabd1 |
Description
Rebased on #4226.
This change drops
txmeta
from thetxhistory
SQL table when BucketListDB is enabled.Unfortunately, SQLite does not support conditional column deletion, so I've added a new persistent state field indicating whether or not
txmeta
is supported. This allows us to check if thetxmeta
column exists before executing the drop SQL transaction.Addresses #4211.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)