summaryrefslogtreecommitdiff
path: root/db/migrate/20170206115204_add_column_ghost_to_users.rb
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-02-06 17:37:05 +0530
committerTimothy Andrew <mail@timothyandrew.net>2017-02-24 16:50:20 +0530
commit8e684809765fa866a125c176327825ebc565f5b3 (patch)
tree2086025a88fbdefbb355061eaf468e1db593adc9 /db/migrate/20170206115204_add_column_ghost_to_users.rb
parent53c34c7436112d7cac9c3887ada1d5ae630a206c (diff)
downloadgitlab-ce-8e684809765fa866a125c176327825ebc565f5b3.tar.gz
Use a `ghost` boolean to track ghost users.
Rather than using a separate `ghost` state. This lets us have the benefits of both ghost and blocked users (ghost: true, state: blocked) without having to rewrite a number of queries to include cases for `state: ghost`.
Diffstat (limited to 'db/migrate/20170206115204_add_column_ghost_to_users.rb')
-rw-r--r--db/migrate/20170206115204_add_column_ghost_to_users.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20170206115204_add_column_ghost_to_users.rb b/db/migrate/20170206115204_add_column_ghost_to_users.rb
new file mode 100644
index 00000000000..57b66ca91a8
--- /dev/null
+++ b/db/migrate/20170206115204_add_column_ghost_to_users.rb
@@ -0,0 +1,15 @@
+class AddColumnGhostToUsers < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default :users, :ghost, :boolean, default: false, allow_null: false
+ end
+
+ def down
+ remove_column :users, :ghost
+ end
+end