Skip to content

Add columns for operations toggle split

Sean Arnold requested to merge 361585-monitor-visiblity-flag into master

What does this MR do and why?

We want to split the Operations visibility toggle into three seperate toggles: Monitor, Deployments, and Infrastructure. This is because the Operations toggle is too broad and affects too many features, as well as it no longer aligning with the sidebar.

This is the first MR to enable us to do that:

  • Adds 3 new columns for each of the new toggles
  • Set the column values to current value of the Operations toggle
  • Add a feature flag, split_operations_visibility_permissions

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

DB Migrations:

Up
main: == 20220531024905 AddOperationsAccessLevelsToProjectFeature: migrating ========
main: -- add_column(:project_features, :monitor_access_level, :integer, {:null=>false, :default=>20})
main:    -> 0.0150s
main: -- add_column(:project_features, :infrastructure_access_level, :integer, {:null=>false, :default=>20})
main:    -> 0.0014s
main: -- add_column(:project_features, :feature_flags_access_level, :integer, {:null=>false, :default=>20})
main:    -> 0.0015s
main: -- add_column(:project_features, :environments_access_level, :integer, {:null=>false, :default=>20})
main:    -> 0.0015s
main: -- add_column(:project_features, :releases_access_level, :integer, {:null=>false, :default=>20})
main:    -> 0.0018s
main: == 20220531024905 AddOperationsAccessLevelsToProjectFeature: migrated (0.0235s)

main: == 20220531035113 PopulateOperationVisibilityPermissions: migrating ===========
main: -- transaction_open?()
main:    -> 0.0000s
main: == 20220531035113 PopulateOperationVisibilityPermissions: migrated (0.0669s) ==
Down
 rake db:migrate:down:main VERSION=20220531024905
main: == 20220531024905 AddOperationsAccessLevelsToProjectFeature: reverting ========
main: -- remove_column(:project_features, :monitor_access_level)
main:    -> 0.0039s
main: -- remove_column(:project_features, :infrastructure_access_level)
main:    -> 0.0009s
main: -- remove_column(:project_features, :feature_flags_access_level)
main:    -> 0.0008s
main: -- remove_column(:project_features, :environments_access_level)
main:    -> 0.0007s
main: -- remove_column(:project_features, :releases_access_level)
main:    -> 0.0007s
main: == 20220531024905 AddOperationsAccessLevelsToProjectFeature: reverted (0.0090s)

rake db:migrate:down:main VERSION=20220531035113
main: == 20220531035113 PopulateOperationVisibilityPermissions: reverting ===========
main: -- transaction_open?()
main:    -> 0.0001s
main: == 20220531035113 PopulateOperationVisibilityPermissions: reverted (0.0560s) ==
Update query:

https://console.postgres.ai/shared/3af9077c-a8f2-433c-af45-a559fc4c9db0


UPDATE "project_features" SET monitor_access_level=operations_access_level,infrastructure_access_level=operations_access_level, feature_flags_access_level=operations_access_level, environments_access_level=operations_access_level WHERE "project_features"."id" BETWEEN 278964 AND 298964 AND "project_features"."id" >= 278964;
 ModifyTable on public.project_features  (cost=0.44..15732.91 rows=17555 width=110) (actual time=31183.146..31183.148 rows=0 loops=1)
   Buffers: shared hit=347955 read=13841 dirtied=14228 written=463
   I/O Timings: read=29112.816 write=0.000
   ->  Index Scan using project_features_pkey on public.project_features  (cost=0.44..15732.91 rows=17555 width=110) (actual time=36.556..13642.010 rows=16356 loops=1)
         Index Cond: ((project_features.id >= 278964) AND (project_features.id <= 298964) AND (project_features.id >= 278964))
         Buffers: shared hit=8402 read=6211 dirtied=60
         I/O Timings: read=13409.230 write=0.000


Time: 31.185 s
  - planning: 1.161 ms
  - execution: 31.183 s
    - I/O read: 29.113 s
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 347955 (~2.70 GiB) from the buffer pool
  - reads: 13841 (~108.10 MiB) from the OS file cache, including disk I/O
  - dirtied: 14228 (~111.20 MiB)
  - writes: 463 (~3.60 MiB)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #361585 (closed)

Edited by Sean Arnold

Merge request reports