-
Notifications
You must be signed in to change notification settings - Fork 123
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
tapdb: expand allowed proof types in universe-related tables #1386
base: main
Are you sure you want to change the base?
Conversation
774947a
to
d29ee21
Compare
Pull Request Test Coverage Report for Build 13448911508Details
💛 - Coveralls |
d29ee21
to
c1a40a9
Compare
c1a40a9
to
9be9904
Compare
9be9904
to
a06c6a2
Compare
-- ****************************************************************************************** | ||
|
||
-- For universe_roots | ||
ALTER TABLE universe_roots ADD COLUMN proof_type TEXT NOT NULL CHECK(proof_type IN ('issuance', 'transfer')); |
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.
seems like you're using a max line length 100 here, instead of 80
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.
So I don't think we currently have that rule for SQL queries. Eg: queries/mssmt.sql
This commit introduces a migration that expands the allowed values for the "proof_type" column in the universe-related tables by adding new proof types: "burn" and "ignore". Key changes include: - Creation of a new table `proof_types` to store valid proof type values. Before this commit, we used a `CHECK` statement. With the way sqlite works, we can't _alter_ the `CHECK` statement, and just dropping the row would lose data. So instead, we add a new enum-like table instead. This can be updated in future migrations to add new proof types. We then do a migration to update all tables to use this instead. - Updates to the `universe_roots`, `federation_global_sync_config`, and `federation_uni_sync_config` tables to accommodate the new proof types. This involves adding a new column `proof_type_ext` that references the `proof_types` table, copying existing data, and renaming columns to maintain the original structure. - A new test case `TestMigration29` has been added to ensure the migration works as expected, verifying both the migration of existing data and the insertion of new rows with the new proof types. - The `.gitignore` file has been updated to exclude files matching the pattern `.aider*`. Additionally, a down migration script has been created to revert these changes if necessary. This ensures that the database schema can be rolled back to its previous state without data loss.
a06c6a2
to
9bcff01
Compare
@@ -632,6 +619,10 @@ CREATE TABLE proof_transfer_log ( | |||
time_unix TIMESTAMP NOT NULL | |||
); | |||
|
|||
CREATE TABLE proof_types ( |
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.
Nice part about this is that you can spot check the end result of a migration.
allow_sync_insert BOOLEAN NOT NULL, | ||
|
||
-- This field is a boolean that indicates whether or not the given universe | ||
-- should accept remote proof export via federation sync. | ||
allow_sync_export BOOLEAN NOT NULL, | ||
allow_sync_export BOOLEAN NOT NULL, proof_type TEXT REFERENCES proof_types(proof_type), |
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.
Not sure why it didn't do a new line here.
This commit introduces a migration that expands the allowed values for the "proof_type" column in the universe-related tables by adding new proof types: "burn" and "ignore".
Key changes include:
Creation of a new table
proof_types
to store valid proof type values. Before this commit, we used aCHECK
statement. With the way sqlite works, we can't alter theCHECK
statement, and just dropping the row would lose data.So instead, we add a new enum-like table instead. This can be updated in future migrations to add new proof types. We then do a migration to update all tables to use this instead.
Updates to the
universe_roots
,federation_global_sync_config
, andfederation_uni_sync_config
tables to accommodate the new proof types. This involves adding a new columnproof_type_ext
that references theproof_types
table, copying existing data, and renaming columns to maintain the original structure.A new test case
TestMigration29
has been added to ensure the migration works as expected, verifying both the migration of existing data and the insertion of new rows with the new proof types.The
.gitignore
file has been updated to exclude files matching the pattern.aider*
.Additionally, a down migration script has been created to revert these changes if necessary. This ensures that the database schema can be rolled back to its previous state without data loss.