parent
7900b1ff8c
commit
87e854543f
@ -1,27 +0,0 @@ |
|||||||
#-- copyright |
|
||||||
# OpenProject is a project management system. |
|
||||||
# |
|
||||||
# Copyright (C) 2012-2013 the OpenProject Team |
|
||||||
# |
|
||||||
# This program is free software; you can redistribute it and/or |
|
||||||
# modify it under the terms of the GNU General Public License version 3. |
|
||||||
# |
|
||||||
# See doc/COPYRIGHT.rdoc for more details. |
|
||||||
#++ |
|
||||||
|
|
||||||
class AddProjectsOverviews < ActiveRecord::Migration |
|
||||||
def self.up |
|
||||||
create_table :my_projects_overviews, :force => true do |t| |
|
||||||
t.column "project_id", :integer, :default => 0, :null => false |
|
||||||
t.column "left", :string, :default => ["wiki", "projectdetails", "issuetracking"].to_yaml, :null => false |
|
||||||
t.column "right", :string, :default => ["members", "news"].to_yaml, :null => false |
|
||||||
t.column "top", :string, :default => [].to_yaml, :null => false |
|
||||||
t.column "hidden", :string, :default => [].to_yaml, :null => false |
|
||||||
t.column "created_on", :datetime, :null => false |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
def self.down |
|
||||||
drop_table :my_projects_overviews |
|
||||||
end |
|
||||||
end |
|
@ -1,35 +0,0 @@ |
|||||||
#-- copyright |
|
||||||
# OpenProject is a project management system. |
|
||||||
# |
|
||||||
# Copyright (C) 2012-2013 the OpenProject Team |
|
||||||
# |
|
||||||
# This program is free software; you can redistribute it and/or |
|
||||||
# modify it under the terms of the GNU General Public License version 3. |
|
||||||
# |
|
||||||
# See doc/COPYRIGHT.rdoc for more details. |
|
||||||
#++ |
|
||||||
|
|
||||||
class ChangeSerializedColumnsFromStringToText < ActiveRecord::Migration |
|
||||||
def self.up |
|
||||||
change_table :my_projects_overviews do |t| |
|
||||||
t.change_default "left", nil |
|
||||||
t.change_default "right", nil |
|
||||||
t.change_default "top", nil |
|
||||||
t.change_default "hidden", nil |
|
||||||
|
|
||||||
t.change "left", :text, :null => false |
|
||||||
t.change "right", :text, :null => false |
|
||||||
t.change "top", :text, :null => false |
|
||||||
t.change "hidden", :text, :null => false |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
def self.down |
|
||||||
change_table :my_projects_overviews do |t| |
|
||||||
t.change "left", :string, :default => ["wiki", "projectdetails", "issuetracking"].to_yaml, :null => false |
|
||||||
t.change "right", :string, :default => ["members", "news"].to_yaml, :null => false |
|
||||||
t.change "top", :string, :default => [].to_yaml, :null => false |
|
||||||
t.change "hidden", :string, :default => [].to_yaml, :null => false |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
@ -1,27 +0,0 @@ |
|||||||
#-- copyright |
|
||||||
# OpenProject is a project management system. |
|
||||||
# |
|
||||||
# Copyright (C) 2012-2013 the OpenProject Team |
|
||||||
# |
|
||||||
# This program is free software; you can redistribute it and/or |
|
||||||
# modify it under the terms of the GNU General Public License version 3. |
|
||||||
# |
|
||||||
# See doc/COPYRIGHT.rdoc for more details. |
|
||||||
#++ |
|
||||||
|
|
||||||
class CreateDefaultMyProjectsPage < ActiveRecord::Migration |
|
||||||
def self.up |
|
||||||
# creates a default my project page config for each project |
|
||||||
# that pretty much mirrors the contents of the static page |
|
||||||
# if there is already a my project page then don't create a second one |
|
||||||
Project.all.each do |project| |
|
||||||
unless MyProjectsOverview.exists? :project_id => project.id |
|
||||||
MyProjectsOverview.create :project => project |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
def self.down |
|
||||||
MyProjectsOverview.destroy_all |
|
||||||
end |
|
||||||
end |
|
@ -0,0 +1,46 @@ |
|||||||
|
require Rails.root.join("db","migrate","migration_utils","migration_squasher").to_s |
||||||
|
require 'open_project/plugins/migration_mapping' |
||||||
|
# This migration aggregates the migrations detailed in MIGRATION_FILES |
||||||
|
class AggregatedMyProjectPageMigrations < ActiveRecord::Migration |
||||||
|
|
||||||
|
def initialize |
||||||
|
super |
||||||
|
@issues_table_exists = ActiveRecord::Base.connection.tables.include? 'issues' |
||||||
|
end |
||||||
|
|
||||||
|
MIGRATION_FILES = <<-MIGRATIONS |
||||||
|
20110804151010_add_projects_overviews.rb |
||||||
|
20111202150017_change_serialized_columns_from_string_to_text.rb |
||||||
|
20120605121847_create_default_my_projects_page.rb |
||||||
|
MIGRATIONS |
||||||
|
|
||||||
|
OLD_PLUGIN_NAME = "chiliproject_my_project_page" |
||||||
|
|
||||||
|
def up |
||||||
|
migration_names = OpenProject::Plugins::MigrationMapping.migration_files_to_migration_names(MIGRATION_FILES, OLD_PLUGIN_NAME) |
||||||
|
Migration::MigrationSquasher.squash(migration_names) do |
||||||
|
create_table :my_projects_overviews do |t| |
||||||
|
t.integer "project_id", default: 0, null: false |
||||||
|
t.text "left", default: ["wiki", "projectdetails", "issuetracking"].to_yaml, null: false |
||||||
|
t.text "right", default: ["members", "news"].to_yaml, null: false |
||||||
|
t.text "top", default: [].to_yaml, null: false |
||||||
|
t.text "hidden", default: [].to_yaml, null: false |
||||||
|
t.datetime "created_on", null: false |
||||||
|
end |
||||||
|
|
||||||
|
# creates a default my project page config for each project |
||||||
|
# that pretty much mirrors the contents of the static page |
||||||
|
# if there is already a my project page then don't create a second one |
||||||
|
Project.all.each do |project| |
||||||
|
unless MyProjectsOverview.exists? project_id: project.id |
||||||
|
MyProjectsOverview.create project: project |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def down |
||||||
|
drop_table :my_projects_overviews |
||||||
|
end |
||||||
|
end |
||||||
|
|
Loading…
Reference in new issue