Removed legacy schema migrations

This commit is contained in:
Luke Barratt 2014-03-23 02:00:56 +00:00
parent 0f6b953222
commit 2cbdbdcde2
18 changed files with 0 additions and 479 deletions

View file

@ -1,10 +0,0 @@
class AddBracketName < ActiveRecord::Migration
def self.up
change_table :brackets do |b|
b.string :name
end
end
def self.down
end
end

View file

@ -1,12 +0,0 @@
class AddPower < ActiveRecord::Migration
def self.up
User.all.each do |user|
if user.team
user.update_attribute :team_id, nil unless user.active_teams.include? user.team
end
end
end
def self.down
end
end

View file

@ -1,14 +0,0 @@
class CreateLogEvents < ActiveRecord::Migration
def self.up
create_table :log_events do |t|
t.string :name
t.string :description
t.integer :team
t.timestamps
end
end
def self.down
drop_table :log_events
end
end

View file

@ -1,10 +0,0 @@
class AddGatherVotes < ActiveRecord::Migration
def self.up
change_table :gathers do |g|
g.integer :votes, :null => false, :default => 0
end
end
def self.down
end
end

View file

@ -1,225 +0,0 @@
class GatherIndexes < ActiveRecord::Migration
def self.up
# These indexes were found by searching for AR::Base finds on your applicaton
# It is strongly recommanded that you will consult a professional DBA about your infrastucture and implemntation before
# changing your database in that matter.
# There is a possibility that some of the indexes offered below is not requ red and can be removed and not added, if you require
# further assistance with your rails application, database infrastructure oany other problem, visit:
#
# http://www.railsmentors.org
# http://www.railstutor.org
# http://guides.rubyonrails.org
add_index :brackets, :contest_id
add_index :contesters, :contest_id
add_index :contesters, :team_id
add_index :directories, :parent_id
add_index :gatherers, :user_id
add_index :teams, :founder_id
add_index :bracketers, :match_id
#add_index :bracketers, :contest_id
add_index :bracketers, :team_id
add_index :matches, :server_id
add_index :matches, :contester1_id
add_index :matches, :contester2_id
add_index :matches, :referee_id
#add_index :matches, :stream_id
add_index :matches, :map1_id
add_index :matches, :contest_id
add_index :matches, :motm_id
add_index :matches, :map2_id
add_index :matches, :challenge_id
add_index :matches, :demo_id
add_index :matches, :week_id
add_index :matches, :hltv_id
add_index :messages, [:sender_id, :sender_type]
add_index :messages, [:recipient_id, :recipient_type]
add_index :watchers, :movie_id
add_index :watchers, :user_id
add_index :comments, :user_id
add_index :contests, :rules_id
add_index :contests, :demos_id
add_index :contests, :winner_id
add_index :gathers, :server_id
add_index :gathers, :captain1_id
add_index :gathers, :map1_id
add_index :gathers, :captain2_id
add_index :gathers, :map2_id
add_index :groups, :founder_id
add_index :rounders, :round_id
add_index :rounders, :team_id
add_index :rounders, :user_id
add_index :teamers, :user_id
add_index :teamers, :team_id
add_index :votes, [:votable_id, :votable_type]
add_index :votes, :user_id
add_index :predictions, :match_id
add_index :predictions, :user_id
add_index :shoutmsgs, :user_id
add_index :topics, :user_id
add_index :contests_maps, [:map_id, :contest_id]
add_index :contests_maps, [:contest_id, :map_id]
add_index :matchers, :match_id
add_index :matchers, :contester_id
add_index :matchers, :user_id
add_index :data_files, :related_id
add_index :data_files, :directory_id
add_index :data_files, :article_id
add_index :articles, :category_id
add_index :articles, :user_id
add_index :forums, :category_id
add_index :groupers, :group_id
add_index :movies, :match_id
add_index :movies, :preview_id
add_index :movies, :user_id
add_index :bans, :server_id
add_index :bans, :user_id
add_index :issues, :assigned_id
add_index :issues, :category_id
add_index :issues, :author_id
add_index :logs, :target_id
add_index :logs, :server_id
add_index :logs, :round_id
add_index :logs, :log_file_id
#add_index :logs, :details_id
add_index :logs, :actor_id
add_index :pcws, :user_id
add_index :pcws, :team_id
add_index :posts, :topic_id
add_index :posts, :user_id
add_index :users, :team_id
add_index :admin_requests, :server_id
add_index :admin_requests, :user_id
add_index :challenges, :server_id
add_index :challenges, :contester1_id
add_index :challenges, :contester2_id
add_index :challenges, :map1_id
add_index :challenges, :map2_id
add_index :challenges, :user_id
add_index :forumers, :group_id
add_index :gather_maps, :map_id
add_index :gather_maps, :gather_id
add_index :polls, :user_id
add_index :rounds, :map_id
add_index :rounds, :team1_id
add_index :rounds, :server_id
add_index :rounds, :match_id
add_index :rounds, :team2_id
add_index :rounds, :commander_id
add_index :servers, :match_id
add_index :servers, :default_id
add_index :servers, :user_id
add_index :weeks, :map1_id
add_index :weeks, :contest_id
add_index :weeks, :map2_id
add_index :log_files, :server_id
end
def self.down
remove_index :brackets, :contest_id
remove_index :contesters, :contest_id
remove_index :contesters, :team_id
remove_index :directories, :parent_id
remove_index :gatherers, :user_id
remove_index :teams, :founder_id
remove_index :bracketers, :match_id
remove_index :bracketers, :contest_id
remove_index :bracketers, :team_id
remove_index :matches, :server_id
remove_index :matches, :contester1_id
remove_index :matches, :contester2_id
remove_index :matches, :referee_id
remove_index :matches, :stream_id
remove_index :matches, :map1_id
remove_index :matches, :contest_id
remove_index :matches, :motm_id
remove_index :matches, :map2_id
remove_index :matches, :challenge_id
remove_index :matches, :demo_id
remove_index :matches, :week_id
remove_index :matches, :hltv_id
remove_index :messages, :column => [:sender_id, :sender_type]
remove_index :messages, :column => [:recipient_id, :recipient_type]
remove_index :watchers, :movie_id
remove_index :watchers, :user_id
remove_index :comments, :user_id
remove_index :contests, :rules_id
remove_index :contests, :demos_id
remove_index :contests, :winner_id
remove_index :gathers, :server_id
remove_index :gathers, :captain1_id
remove_index :gathers, :map1_id
remove_index :gathers, :captain2_id
remove_index :gathers, :map2_id
remove_index :groups, :founder_id
remove_index :rounders, :round_id
remove_index :rounders, :team_id
remove_index :rounders, :user_id
remove_index :teamers, :user_id
remove_index :teamers, :team_id
remove_index :votes, :column => [:votable_id, :votable_type]
remove_index :votes, :user_id
remove_index :predictions, :match_id
remove_index :predictions, :user_id
remove_index :shoutmsgs, :user_id
remove_index :topics, :user_id
remove_index :contests_maps, :column => [:map_id, :contest_id]
remove_index :contests_maps, :column => [:contest_id, :map_id]
remove_index :matchers, :match_id
remove_index :matchers, :contester_id
remove_index :matchers, :user_id
remove_index :data_files, :related_id
remove_index :data_files, :directory_id
remove_index :data_files, :article_id
remove_index :articles, :category_id
remove_index :articles, :user_id
remove_index :forums, :category_id
remove_index :groupers, :group_id
remove_index :movies, :match_id
remove_index :movies, :preview_id
remove_index :movies, :user_id
remove_index :bans, :server_id
remove_index :bans, :user_id
remove_index :issues, :assigned_id
remove_index :issues, :category_id
remove_index :issues, :author_id
remove_index :logs, :target_id
remove_index :logs, :server_id
remove_index :logs, :round_id
remove_index :logs, :log_file_id
remove_index :logs, :details_id
remove_index :logs, :actor_id
remove_index :pcws, :user_id
remove_index :pcws, :team_id
remove_index :posts, :topic_id
remove_index :posts, :user_id
remove_index :users, :team_id
remove_index :admin_requests, :server_id
remove_index :admin_requests, :user_id
remove_index :challenges, :server_id
remove_index :challenges, :contester1_id
remove_index :challenges, :contester2_id
remove_index :challenges, :map1_id
remove_index :challenges, :map2_id
remove_index :challenges, :user_id
remove_index :forumers, :group_id
remove_index :gather_maps, :map_id
remove_index :gather_maps, :gather_id
remove_index :polls, :user_id
remove_index :rounds, :map_id
remove_index :rounds, :team1_id
remove_index :rounds, :server_id
remove_index :rounds, :match_id
remove_index :rounds, :team2_id
remove_index :rounds, :commander_id
remove_index :servers, :match_id
remove_index :servers, :default_id
remove_index :servers, :user_id
remove_index :weeks, :map1_id
remove_index :weeks, :contest_id
remove_index :weeks, :map2_id
remove_index :log_files, :server_id
end
end

View file

@ -1,10 +0,0 @@
class AddMovieCategory < ActiveRecord::Migration
def self.up
change_table :movies do |m|
m.integer :category_id
end
end
def self.down
end
end

View file

@ -1,29 +0,0 @@
class AddMovieCategory2 < ActiveRecord::Migration
def self.up
long = Category.new
long.name = "Full-Length"
long.domain = Category::DOMAIN_MOVIES
long.save
short = Category.new
short.name = "Shorts"
short.domain = Category::DOMAIN_MOVIES
short.save
mock = Category.new
mock.name = "Mock-ups"
mock.domain = Category::DOMAIN_MOVIES
mock.save
Movie.all.each do |m|
if m.length and m.length < 180
m.category = short
m.save
elsif m.length and m.length >= 180
m.category = long
m.save
end
end
end
def self.down
end
end

View file

@ -1,15 +0,0 @@
class GatherLocks < ActiveRecord::Migration
def self.up
# change_table :gatherers do |g|
# g.integer :lock_version, :default => 0
# end
# change_table :gathers do |g|
# g.integer :lock_version, :default => 0
# end
end
def self.down
# remove_column :gatherers, :lock_version
# remove_column :gathers, :lock_version
end
end

View file

@ -1,11 +0,0 @@
class AddMoreIndexes < ActiveRecord::Migration
def self.up
add_index :pcws, :match_time
add_index :movies, :status
add_index :gatherers, :gather_id
add_index :comments, [:commentable_type, :id]
end
def self.down
end
end

View file

@ -1,12 +0,0 @@
class AddRecordable < ActiveRecord::Migration
def self.up
change_table :servers do |m|
m.remove :match_id
m.string :recordable_type
m.integer :recordable_id
end
end
def self.down
end
end

View file

@ -1,14 +0,0 @@
class CreateGatherServers < ActiveRecord::Migration
def self.up
create_table :gather_servers do |t|
t.references :gather
t.references :server
t.integer :votes
t.timestamps
end
end
def self.down
drop_table :gather_servers
end
end

View file

@ -1,15 +0,0 @@
class CreateDeleteds < ActiveRecord::Migration
def self.up
create_table :deleteds do |t|
t.integer :deletable_id
t.string :deletable_type
t.references :user
t.text :reason
t.timestamps
end
end
def self.down
drop_table :deleteds
end
end

View file

@ -1,10 +0,0 @@
class AddRelatedDeletion < ActiveRecord::Migration
def self.up
change_table :deleteds do |d|
d.integer :related_id
end
end
def self.down
end
end

View file

@ -1,22 +0,0 @@
class CreateFirms < ActiveRecord::Migration
def self.up
create_table :firms do |t|
t.string :name
t.string :y_code
t.string :email
t.string :website
t.string :phone
t.string :address
t.integer :zipcode
t.string :town
t.integer :owner
t.string :opentime
t.timestamps
end
end
def self.down
drop_table :firms
end
end

View file

@ -1,22 +0,0 @@
class ChangeImages < ActiveRecord::Migration
def up
Profile.transaction do
Profile.where("avatar IS NOT NULL").each do |p|
Profile.update_all(["avatar = ?", "#{p.id}#{File.extname(p.avatar.to_s)}"], "id = #{p.id}") if p.avatar and p.avatar.to_s
end
end
Movie.transaction do
Movie.where("picture IS NOT NULL").each do |p|
Movie.update_all(["picture = ?", "#{p.id}#{File.extname(p.picture.to_s)}"], "id = #{p.id}") if p.picture and p.picture.to_s
end
end
Team.transaction do
Team.where("logo IS NOT NULL").each do |p|
Team.update_all(["logo = ?", "#{p.id}#{File.extname(p.logo.to_s)}"], "id = #{p.id}") if p.logo and p.logo.to_s
end
end
end
def down
end
end

View file

@ -1,10 +0,0 @@
class AddNs2 < ActiveRecord::Migration
def up
change_table :gathers do |t|
t.references :category
end
end
def down
end
end

View file

@ -1,28 +0,0 @@
class AddNs2Maps < ActiveRecord::Migration
def up
Gather.all.each do |g|
g.update_attribute :category_id, 44
end
change_table :servers do |s|
s.references :category
end
Server.all.each do |s|
s.update_attribute :category_id, 44
end
change_table :maps do |m|
m.references :category
end
Map.all.each do |s|
s.update_attribute :category_id, 44
end
end
def down
change_table :servers do |s|
s.remove :category_id
end
change_table :maps do |s|
s.remove :category_id
end
end
end

View file

@ -1,10 +0,0 @@
class BigSession < ActiveRecord::Migration
def up
change_table :sessions do |t|
t.change :data, :longtext
end
end
def down
end
end