Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorAndrew8xx8 <avk@8xx8.ru>2013-03-04 18:51:00 +0400
committerAndrew8xx8 <avk@8xx8.ru>2013-03-04 18:51:00 +0400
commit9a06dd4aa1ab008b6e12205ec3f8d00a50f79aa1 (patch)
tree352dac5bd0e52ce800de2fdf6d09c6c51baa3556 /db
parent152c6018b3ace729095e7b58f5be3963b81050fb (diff)
Migrations added
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20130304104623_add_state_to_user.rb5
-rw-r--r--db/migrate/20130304104740_convert_blocked_to_state.rb14
-rw-r--r--db/migrate/20130304105317_remove_blocked_from_user.rb9
3 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20130304104623_add_state_to_user.rb b/db/migrate/20130304104623_add_state_to_user.rb
new file mode 100644
index 00000000000..8154c21065f
--- /dev/null
+++ b/db/migrate/20130304104623_add_state_to_user.rb
@@ -0,0 +1,5 @@
+class AddStateToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :state, :string
+ end
+end
diff --git a/db/migrate/20130304104740_convert_blocked_to_state.rb b/db/migrate/20130304104740_convert_blocked_to_state.rb
new file mode 100644
index 00000000000..91c65d4fd39
--- /dev/null
+++ b/db/migrate/20130304104740_convert_blocked_to_state.rb
@@ -0,0 +1,14 @@
+class ConvertBlockedToState < ActiveRecord::Migration
+ def up
+ User.transaction do
+ User.where(blocked: true).update_all(state: :blocked)
+ User.where(blocked: false).update_all(state: :active)
+ end
+ end
+
+ def down
+ User.transaction do
+ User.where(satate: :blocked).update_all(blocked: :true)
+ end
+ end
+end
diff --git a/db/migrate/20130304105317_remove_blocked_from_user.rb b/db/migrate/20130304105317_remove_blocked_from_user.rb
new file mode 100644
index 00000000000..e010474538c
--- /dev/null
+++ b/db/migrate/20130304105317_remove_blocked_from_user.rb
@@ -0,0 +1,9 @@
+class RemoveBlockedFromUser < ActiveRecord::Migration
+ def up
+ remove_column :users, :blocked
+ end
+
+ def down
+ add_column :users, :blocked, :boolean
+ end
+end