Skip to content

Add group level features

What does this MR do?

In this MR I have refactored ProjectFeatures and introduce GroupFeatures. Now it has only Wiki-feature, I think in future possible refactoring of other features (as MergeRequests, Issues, etc). UI for edit GroupFeatures looks like old ProjectFeatures UI.

Are there points in the code the reviewer needs to double check?

This MR and !13083 (closed) closely related (this MR add GroupWiki feature, that implement the feature)

Why was this MR needed?

This MR needed for !13083 (closed). And it created for simplify review.

Does this MR meet the acceptance criteria?

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
  • Added the execution time of the migration(s) to the MR body
  • Added tests for the migration in spec/migrations if necessary (e.g. when migrating data)

When adding tables:

  • Ordered columns based on their type sizes in descending order
  • Added foreign keys if necessary
  • Added indexes if necessary

Database output

== 20171023090910 CreateGroupFeatures: migrating ==============================
-- create_table(:group_features)
   -> 0.0125s
-- transaction_open?()
   -> 0.0000s
-- execute("SET statement_timeout TO 0")
   -> 0.0003s
-- execute("ALTER TABLE group_features\nADD CONSTRAINT fk_356514082b\nFOREIGN KEY (group_id)\nREFERENCES namespaces (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0021s
-- execute("ALTER TABLE group_features VALIDATE CONSTRAINT fk_356514082b;")
   -> 0.0018s
-- execute("INSERT INTO group_features(group_id, wiki_access_level, created_at, updated_at)\n  SELECT\n    id AS group_id,\n    0 AS wiki_access_level,\n    created_at,\n    updated_at\n  FROM namespaces\n  WHERE\n    type IN ('Group')\n")
   -> 0.0018s
== 20171023090910 CreateGroupFeatures: migrated (0.0193s) =====================
# EXPLAIN  INSERT INTO group_features(group_id, wiki_access_level, created_at, updated_at)
#         SELECT
#           id AS group_id,
#           0 AS wiki_access_level,
#           created_at,
#           updated_at
#         FROM namespaces
#         WHERE
#           type IN ('Group');
                           QUERY PLAN
 Insert on group_features  (cost=0.00..1.68 rows=6 width=28)
   ->  Seq Scan on namespaces  (cost=0.00..1.68 rows=6 width=28)
         Filter: ((type)::text = 'Group'::text)
(3 rows)

What are the relevant issue numbers?

#4037 (moved)

Edited by Alexander Randa

Merge request reports