Adds creator_id field to packages table
What does this MR do?
Adds creator_id
fields to the packages table and index it.
This is gonna be used in for counting in the usage data. We want to track the count of unique users publishing packages.
So a follow up MR will populate this field when creating packages and then we can do the aggragate queries on that data.
Migrations (Up)
== 20200827005322 AddCreatorIdToPackages: migrating ===========================
-- add_column(:packages_packages, :creator_id, :integer)
-> 0.0015s
== 20200827005322 AddCreatorIdToPackages: migrated (0.0016s) ==================
== 20200830201204 AddIndexToPackageCreator: migrating =========================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:packages_packages, :creator_id, {:name=>"index_packages_packages_on_creator_id", :algorithm=>:concurrently})
-> 0.0118s
-- add_index(:packages_packages, :creator_id, {:name=>"index_packages_packages_on_creator_id", :algorithm=>:concurrently})
-> 0.2132s
-- transaction_open?()
-> 0.0000s
-- foreign_keys(:packages_packages)
-> 0.0242s
-- execute("ALTER TABLE packages_packages\nADD CONSTRAINT fk_c188f0dba4\nFOREIGN KEY (creator_id)\nREFERENCES users (id)\nON DELETE SET NULL\nNOT VALID;\n")
-> 0.2436s
-- execute("ALTER TABLE packages_packages VALIDATE CONSTRAINT fk_c188f0dba4;")
-> 0.0758s
== 20200830201204 AddIndexToPackageCreator: migrated (0.6002s) ================
Migration (down)
== 20200830201204 AddIndexToPackageCreator: reverting =========================
-- foreign_keys(:packages_packages)
-> 0.0048s
-- remove_foreign_key(:packages_packages, :users, {:column=>:creator_id})
-> 0.0084s
-- transaction_open?()
-> 0.0000s
-- indexes(:packages_packages)
-> 0.0088s
-- remove_index(:packages_packages, {:algorithm=>:concurrently, :name=>"index_packages_packages_on_creator_id"})
-> 0.0027s
== 20200830201204 AddIndexToPackageCreator: reverted (0.0260s) ================
== 20200827005322 AddCreatorIdToPackages: reverting ===========================
-- remove_column(:packages_packages, :creator_id, :integer)
-> 0.0060s
== 20200827005322 AddCreatorIdToPackages: reverted (0.0086s) ==================
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Part of #205578 (closed)
Edited by Giorgenes Gelatti