From 1d9de9d7585f2c753b629080b1239969aaf8499a Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Fri, 9 Dec 2011 03:15:59 +0100 Subject: Run also migrations in subdirectories. With this commit, ActiveRecord will also look for migrations in db/migrate subdirectories. --- .../1_valid_people_have_last_names.rb | 9 +++++++++ .../valid_with_subdirectories/sub/2_we_need_reminders.rb | 12 ++++++++++++ .../valid_with_subdirectories/sub1/3_innocent_jointable.rb | 12 ++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb create mode 100644 activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb create mode 100644 activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb (limited to 'activerecord/test/migrations') diff --git a/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb new file mode 100644 index 0000000000..06cb911117 --- /dev/null +++ b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb @@ -0,0 +1,9 @@ +class ValidPeopleHaveLastNames < ActiveRecord::Migration + def self.up + add_column "people", "last_name", :string + end + + def self.down + remove_column "people", "last_name" + end +end diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb new file mode 100644 index 0000000000..d5e71ce8ef --- /dev/null +++ b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb @@ -0,0 +1,12 @@ +class WeNeedReminders < ActiveRecord::Migration + def self.up + create_table("reminders") do |t| + t.column :content, :text + t.column :remind_at, :datetime + end + end + + def self.down + drop_table "reminders" + end +end \ No newline at end of file diff --git a/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb new file mode 100644 index 0000000000..21c9ca5328 --- /dev/null +++ b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb @@ -0,0 +1,12 @@ +class InnocentJointable < ActiveRecord::Migration + def self.up + create_table("people_reminders", :id => false) do |t| + t.column :reminder_id, :integer + t.column :person_id, :integer + end + end + + def self.down + drop_table "people_reminders" + end +end \ No newline at end of file -- cgit v1.2.3