Add fields to Checkpoint
What does this MR do and why?
Add version_format and data_type to checkpoints.
Migration
migration
rails db:migrate:main VERSION=20230503100753
main: == [advisory_lock_connection] object_id: 275040, pg_backend_pid: 66714
main: == 20230503100753 AddVersionFormatAndDataTypeToCheckpoints: migrating =========
main: -- add_column(:pm_checkpoints, :data_type, :integer, {:limit=>2, :default=>1, :null=>false})
main: -> 0.0025s
main: -- add_column(:pm_checkpoints, :version_format, :integer, {:limit=>2, :default=>1, :null=>false})
main: -> 0.0007s
main: -- add_index(:pm_checkpoints, [:purl_type, :data_type, :version_format], {:unique=>true, :name=>:pm_checkpoints_unique_index})
main: -> 0.0011s
main: -- transaction_open?()
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints)
main: -> 0.0000s
main: -- quote_column_name(:pm_checkpoints_pkey)
main: -> 0.0001s
main: -- execute("ALTER TABLE \"pm_checkpoints\" DROP CONSTRAINT \"pm_checkpoints_pkey\" CASCADE\n")
main: -> 0.0006s
main: -- quote_table_name(:pm_checkpoints)
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints_pkey)
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints_unique_index)
main: -> 0.0000s
main: -- execute("ALTER TABLE \"pm_checkpoints\" ADD CONSTRAINT \"pm_checkpoints_pkey\" PRIMARY KEY USING INDEX \"pm_checkpoints_unique_index\"\n")
main: -> 0.0006s
main: == 20230503100753 AddVersionFormatAndDataTypeToCheckpoints: migrated (0.0104s)
main: == [advisory_lock_connection] object_id: 275040, pg_backend_pid: 66714
rails db:rollback:main VERSION=20230503100753
main: == [advisory_lock_connection] object_id: 274840, pg_backend_pid: 66210
main: == 20230503100753 AddVersionFormatAndDataTypeToCheckpoints: reverting =========
main: -- add_index(:pm_checkpoints, [:purl_type], {:unique=>true, :name=>:pm_checkpoints_unique_index})
main: -> 0.0023s
main: -- transaction_open?()
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints)
main: -> 0.0000s
main: -- quote_column_name(:pm_checkpoints_pkey)
main: -> 0.0000s
main: -- execute("ALTER TABLE \"pm_checkpoints\" DROP CONSTRAINT \"pm_checkpoints_pkey\" CASCADE\n")
main: -> 0.0005s
main: -- quote_table_name(:pm_checkpoints)
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints_pkey)
main: -> 0.0000s
main: -- quote_table_name(:pm_checkpoints_unique_index)
main: -> 0.0000s
main: -- execute("ALTER TABLE \"pm_checkpoints\" ADD CONSTRAINT \"pm_checkpoints_pkey\" PRIMARY KEY USING INDEX \"pm_checkpoints_unique_index\"\n")
main: -> 0.0006s
main: -- remove_column(:pm_checkpoints, :version_format)
main: -> 0.0003s
main: -- remove_column(:pm_checkpoints, :data_type)
main: -> 0.0003s
main: == 20230503100753 AddVersionFormatAndDataTypeToCheckpoints: reverted (0.0078s)
How to set up and validate locally
- Can be tested in rails console by creating a new model object.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406323 (closed)
Edited by Aditya Tiwari