Skip to content

Adds event enum column to DesignsVersions join table

Alex Kalderimis requested to merge delete-designs-v2 into master

What does this MR do?

This adds a column, event to the DesignManagement::DesignsVersion model, representing the edge between Design and Version. This column is an enum marking what kind of event was applied to the design at this version.

This is in support of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14656

Database checklist

When adding migrations:

  • Updated db/schema.rb
  • Added a down method so the migration can be reverted
  • Added the output of the migration(s) to the MR body
$ rails db:migrate
$ rails db:migrate
== 20190715140740 AddEventTypeToDesignManagementDesignsVersions: migrating ====
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0004s
-- transaction()
-- add_column(:design_management_designs_versions, :event, :integer, {:default=>nil})
   -> 0.0008s
-- change_column_default(:design_management_designs_versions, :event, 0)
   -> 0.0020s
   -> 0.0190s
-- columns(:design_management_designs_versions)
   -> 0.0010s
-- transaction_open?()
   -> 0.0000s
-- exec_query("SELECT COUNT(*) AS count FROM \"design_management_designs_versions\"")
   -> 0.0005s
-- change_column_null(:design_management_designs_versions, :event, false)
   -> 0.0020s
-- execute("RESET ALL")
   -> 0.0002s
== 20190715140740 AddEventTypeToDesignManagementDesignsVersions: migrated (0.0235s)

And adding indices:

$ rails db:migrate
== 20190715144003 AddIndexesOnDesignManagementDesignsVersionsEvent: migrating =
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:design_management_designs_versions, :event, {:algorithm=>:concurrently})
   -> 0.0026s
-- execute("SET statement_timeout TO 0")
   -> 0.0003s
-- add_index(:design_management_designs_versions, :event, {:algorithm=>:concurrently})
   -> 0.0111s
-- execute("RESET ALL")
   -> 0.0002s
== 20190715144003 AddIndexesOnDesignManagementDesignsVersionsEvent: migrated (0.0145s)
  • Added tests for the migration in spec/migrations if necessary (e.g. when migrating data)

General checklist

Replaces !30694 (closed)

Edited by Alex Kalderimis

Merge request reports

Loading