Skip to content
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

Prevent unintended schema changes #125

Open
marino39 opened this issue Feb 16, 2024 · 0 comments
Open

Prevent unintended schema changes #125

marino39 opened this issue Feb 16, 2024 · 0 comments
Assignees

Comments

@marino39
Copy link
Collaborator

marino39 commented Feb 16, 2024

It may happen that types used by bond.Table[T] change. The current bond version does not have any protection against that.

To make the situation a little bit better we could use https://github.com/fatih/structs to dump all of the T field names and types and store them in pebble. We could do that in bond.NewTable and verify if the schemas match. If don't we could return an error: schema mismatch for table: %d.

This would cover only part of the schema which are rows. We still need to handle PrimaryKey / Indexes. We could try to serialize them into something that can be compared as well.

Lastly, we need to make sure that everything serializes in the same way. This can be done by generating a random row serializing it and then comparing it.

The mechanism for schema update shall be provided in the Migration framework. I can't see any temporary shortcuts for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants