-
Notifications
You must be signed in to change notification settings - Fork 110
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
WIP: updating Schema and system tables #1662
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,26 +173,30 @@ macro_rules! st_fields_enum { | |
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!(enum StTableFields { | ||
"table_id", TableId = 0, | ||
"table_name", TableName = 1, | ||
"name", TableName = 1, | ||
"table_type", TableType = 2, | ||
"table_access", TablesAccess = 3, | ||
}); | ||
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!(enum StColumnFields { | ||
"table_id", TableId = 0, | ||
"col_pos", ColPos = 1, | ||
"col_name", ColName = 2, | ||
"col_type", ColType = 3, | ||
"name", ColName = 2, | ||
"type", ColType = 3, | ||
}); | ||
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!(enum StIndexFields { | ||
"index_id", IndexId = 0, | ||
"table_id", TableId = 1, | ||
"index_name", IndexName = 2, | ||
"columns", Columns = 3, | ||
"is_unique", IsUnique = 4, | ||
"index_type", IndexType = 5, | ||
}); | ||
st_fields_enum!( | ||
enum StIndexFields { | ||
"index_id", IndexId = 0, | ||
"table_id", TableId = 1, | ||
"index_name", IndexName = 2, | ||
|
||
// TODO(jgilles): can a system table store an enum? | ||
// What if we need to add new variants to the enum? Will that break | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, system tables can store any SATN type. |
||
// the schema? Does this need to store a byte array instead? | ||
"index_algorithm", IndexAlgorithm = 3, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This unfortunately doesn't tell me what the type of this field is. Could you put a schema for all the tables in a comment like this: | table_id | table_name | table_type | foobar |
|----------|-------------|------------|-----------------|
| u32 | String | u32 | IndexAlgorithm |
enum IndexAlgorithm {
Foobar(String)
} Or something similar? It's just hard to comment on the changes without the type info. |
||
} | ||
); | ||
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!( | ||
/// The fields that define the internal table [crate::db::relational_db::ST_SEQUENCES_NAME]. | ||
|
@@ -208,13 +212,16 @@ st_fields_enum!( | |
"allocated", Allocated = 8, | ||
}); | ||
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!(enum StConstraintFields { | ||
"constraint_id", ConstraintId = 0, | ||
"constraint_name", ConstraintName = 1, | ||
"constraints", Constraints = 2, | ||
"table_id", TableId = 3, | ||
"columns", Columns = 4, | ||
}); | ||
st_fields_enum!( | ||
enum StConstraintFields { | ||
"constraint_id", ConstraintId = 0, | ||
"name", ConstraintName = 1, | ||
// TODO(jgilles): can a system table store an enum? | ||
// What if we need to add new variants to the enum? Will that break | ||
// the schema? Does this need to store a byte array instead? | ||
"data", ConstraintData = 3, | ||
} | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this to mirror how constraints are represented in Notably postgres appears to put them all in a single table, but I would like you to confirm that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah JK you seem to have done that below. |
||
// WARNING: For a stable schema, don't change the field names and discriminants. | ||
st_fields_enum!(enum StModuleFields { | ||
"database_address", DatabaseAddress = 0, | ||
|
@@ -233,10 +240,10 @@ st_fields_enum!(enum StVarFields { | |
"name", Name = 0, | ||
"value", Value = 1, | ||
}); | ||
|
||
st_fields_enum!(enum StScheduledFields { | ||
"table_id", TableId = 0, | ||
"reducer_name", ReducerName = 1, | ||
"name", Name = 2, | ||
}); | ||
|
||
/// System Table [ST_TABLE_NAME] | ||
|
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.
If you're going to rename
table_name
to name, we should probably dotable_type
andtable_access
. Incidentally, I don't know whattable_type
even is.Better yet, I would just leave these names as is to reducer code churn and errors and then we can do a final pass at the end. So leave it as:
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 agree to keep the prefix for the columns, that helps with debugging.
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.
Yeah and joins.