-
Notifications
You must be signed in to change notification settings - Fork 598
datastore: add columns support #3230
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
base: centril/clear-table-and-fix-drop-table
Are you sure you want to change the base?
datastore: add columns support #3230
Conversation
Co-authored-by: Shubham Mishra <[email protected]> Signed-off-by: Mazdak Farrokhzad <[email protected]>
fb82b01
to
b7bb652
Compare
08b70cf
to
813f34c
Compare
|
||
let mut tx = begin_mut_tx(&datastore); | ||
// insert a row in tx_state when before adding column |
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.
When before?
@@ -3466,4 +3456,58 @@ mod tests { | |||
|
|||
Ok(()) | |||
} | |||
|
|||
#[test] | |||
fn test_table_schemas_consistency() -> ResultTest<()> { |
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.
Could you add some comments to the test, for example explaining what it tests, why 5000 is used, etc?
let table_schema = tx.schema_for_table(table_id).unwrap(); | ||
let table_schema_raw = tx.schema_for_table_raw(table_id).unwrap(); | ||
|
||
//TODO: Fix the bug and update the assert |
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.
Can you file an issue for this and assign it to me?
let default_value = default_values | ||
.get(idx) | ||
.ok_or_else(|| make_err(AddColumnsErrorReason::DefaultValueMissing(new_col.col_pos)))?; | ||
if Some(new_col.col_type.clone()) != default_value.type_of() { |
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.
This is a sound check but its unnecessarily incomplete. Rather than using type_of
, it would be better to introduce AlgebraicType::type_check
to check if the value is compatible with the type. That would be a complete check.
Description of Changes
add_columns_to_table
api to handleAutoMigrateStep::AddColumns
-- Look at doc comment for more Info.depends on: centril/clear-table-and-fix-drop-table
TODO: handle
AutoMigrateStep::DisconnectAllUsers
.API and ABI breaking changes
N/A.
Expected complexity level and risk
2? Changes are not in hotpath but a bug in migration can corrupt tables.
Testing
a test to exercise the API.