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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-11-22 22:34:16 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-11-22 22:34:26 +0400
commite29ccece332e57c9fb6c532a3680e3b457e3a301 (patch)
treef28b3c3a59e36dcf7d0ffb08b0389d113fb76855 /db
parentced242a2d09b65494ae8752b882fa4beed8b58c5 (diff)
Namespace model added. Migration to convert exit project/groups
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20121122145155_convert_group_to_namespace.rb13
-rw-r--r--db/migrate/20121122150932_add_namespace_id_to_project.rb5
-rw-r--r--db/schema.rb21
3 files changed, 29 insertions, 10 deletions
diff --git a/db/migrate/20121122145155_convert_group_to_namespace.rb b/db/migrate/20121122145155_convert_group_to_namespace.rb
new file mode 100644
index 00000000000..fc8b023d814
--- /dev/null
+++ b/db/migrate/20121122145155_convert_group_to_namespace.rb
@@ -0,0 +1,13 @@
+class ConvertGroupToNamespace < ActiveRecord::Migration
+ def up
+ rename_table 'groups', 'namespaces'
+ add_column :namespaces, :type, :string, null: true
+
+ # Migrate old groups
+ Namespace.update_all(type: 'Group')
+ end
+
+ def down
+ raise 'Rollback is not allowed'
+ end
+end
diff --git a/db/migrate/20121122150932_add_namespace_id_to_project.rb b/db/migrate/20121122150932_add_namespace_id_to_project.rb
new file mode 100644
index 00000000000..904f3aa32be
--- /dev/null
+++ b/db/migrate/20121122150932_add_namespace_id_to_project.rb
@@ -0,0 +1,5 @@
+class AddNamespaceIdToProject < ActiveRecord::Migration
+ def change
+ rename_column :projects, :group_id, :namespace_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 27b1f4aa84a..90b027d412b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20121120113838) do
+ActiveRecord::Schema.define(:version => 20121122150932) do
create_table "events", :force => true do |t|
t.string "target_type"
@@ -25,14 +25,6 @@ ActiveRecord::Schema.define(:version => 20121120113838) do
t.integer "author_id"
end
- create_table "groups", :force => true do |t|
- t.string "name", :null => false
- t.string "code", :null => false
- t.integer "owner_id", :null => false
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "issues", :force => true do |t|
t.string "title"
t.integer "assignee_id"
@@ -88,6 +80,15 @@ ActiveRecord::Schema.define(:version => 20121120113838) do
t.datetime "updated_at", :null => false
end
+ create_table "namespaces", :force => true do |t|
+ t.string "name", :null => false
+ t.string "code", :null => false
+ t.integer "owner_id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "type"
+ end
+
create_table "notes", :force => true do |t|
t.text "note"
t.string "noteable_id"
@@ -117,7 +118,7 @@ ActiveRecord::Schema.define(:version => 20121120113838) do
t.boolean "wall_enabled", :default => true, :null => false
t.boolean "merge_requests_enabled", :default => true, :null => false
t.boolean "wiki_enabled", :default => true, :null => false
- t.integer "group_id"
+ t.integer "namespace_id"
end
create_table "protected_branches", :force => true do |t|