aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/migrations')
-rw-r--r--activerecord/test/migrations/10_urban/9_add_expressions.rb13
-rw-r--r--activerecord/test/migrations/decimal/1_give_me_big_numbers.rb17
-rw-r--r--activerecord/test/migrations/empty/.keep0
-rw-r--r--activerecord/test/migrations/magic/1_currencies_have_symbols.rb13
-rw-r--r--activerecord/test/migrations/missing/1000_people_have_middle_names.rb11
-rw-r--r--activerecord/test/migrations/missing/1_people_have_last_names.rb11
-rw-r--r--activerecord/test/migrations/missing/3_we_need_reminders.rb14
-rw-r--r--activerecord/test/migrations/missing/4_innocent_jointable.rb14
-rw-r--r--activerecord/test/migrations/rename/1_we_need_things.rb13
-rw-r--r--activerecord/test/migrations/rename/2_rename_things.rb11
-rw-r--r--activerecord/test/migrations/to_copy/1_people_have_hobbies.rb11
-rw-r--r--activerecord/test/migrations/to_copy/2_people_have_descriptions.rb11
-rw-r--r--activerecord/test/migrations/to_copy2/1_create_articles.rb9
-rw-r--r--activerecord/test/migrations/to_copy2/2_create_comments.rb9
-rw-r--r--activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb11
-rw-r--r--activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb11
-rw-r--r--activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb11
-rw-r--r--activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb9
-rw-r--r--activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb9
-rw-r--r--activerecord/test/migrations/valid/1_valid_people_have_last_names.rb11
-rw-r--r--activerecord/test/migrations/valid/2_we_need_reminders.rb14
-rw-r--r--activerecord/test/migrations/valid/3_innocent_jointable.rb14
-rw-r--r--activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb11
-rw-r--r--activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb14
-rw-r--r--activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb14
-rw-r--r--activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb11
-rw-r--r--activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb14
-rw-r--r--activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb14
-rw-r--r--activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb10
29 files changed, 335 insertions, 0 deletions
diff --git a/activerecord/test/migrations/10_urban/9_add_expressions.rb b/activerecord/test/migrations/10_urban/9_add_expressions.rb
new file mode 100644
index 0000000000..4b0d5fb6fa
--- /dev/null
+++ b/activerecord/test/migrations/10_urban/9_add_expressions.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddExpressions < ActiveRecord::Migration::Current
+ def self.up
+ create_table("expressions") do |t|
+ t.column :expression, :string
+ end
+ end
+
+ def self.down
+ drop_table "expressions"
+ end
+end
diff --git a/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb
new file mode 100644
index 0000000000..b892f50e41
--- /dev/null
+++ b/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class GiveMeBigNumbers < ActiveRecord::Migration::Current
+ def self.up
+ create_table :big_numbers do |table|
+ table.column :bank_balance, :decimal, precision: 10, scale: 2
+ table.column :big_bank_balance, :decimal, precision: 15, scale: 2
+ table.column :world_population, :decimal, precision: 10
+ table.column :my_house_population, :decimal, precision: 2
+ table.column :value_of_e, :decimal
+ end
+ end
+
+ def self.down
+ drop_table :big_numbers
+ end
+end
diff --git a/activerecord/test/migrations/empty/.keep b/activerecord/test/migrations/empty/.keep
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/activerecord/test/migrations/empty/.keep
diff --git a/activerecord/test/migrations/magic/1_currencies_have_symbols.rb b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb
new file mode 100644
index 0000000000..2ba2875751
--- /dev/null
+++ b/activerecord/test/migrations/magic/1_currencies_have_symbols.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+# coding: ISO-8859-15
+
+class CurrenciesHaveSymbols < ActiveRecord::Migration::Current
+ def self.up
+ # We use € for default currency symbol
+ add_column "currencies", "symbol", :string, default: "€"
+ end
+
+ def self.down
+ remove_column "currencies", "symbol"
+ end
+end
diff --git a/activerecord/test/migrations/missing/1000_people_have_middle_names.rb b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb
new file mode 100644
index 0000000000..d3c9b127fb
--- /dev/null
+++ b/activerecord/test/migrations/missing/1000_people_have_middle_names.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveMiddleNames < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "middle_name", :string
+ end
+
+ def self.down
+ remove_column "people", "middle_name"
+ end
+end
diff --git a/activerecord/test/migrations/missing/1_people_have_last_names.rb b/activerecord/test/migrations/missing/1_people_have_last_names.rb
new file mode 100644
index 0000000000..bd5f5ea11e
--- /dev/null
+++ b/activerecord/test/migrations/missing/1_people_have_last_names.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveLastNames < ActiveRecord::Migration::Current
+ 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/missing/3_we_need_reminders.rb b/activerecord/test/migrations/missing/3_we_need_reminders.rb
new file mode 100644
index 0000000000..4647268c6e
--- /dev/null
+++ b/activerecord/test/migrations/missing/3_we_need_reminders.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class WeNeedReminders < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/missing/4_innocent_jointable.rb b/activerecord/test/migrations/missing/4_innocent_jointable.rb
new file mode 100644
index 0000000000..8063bc0558
--- /dev/null
+++ b/activerecord/test/migrations/missing/4_innocent_jointable.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class InnocentJointable < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/rename/1_we_need_things.rb b/activerecord/test/migrations/rename/1_we_need_things.rb
new file mode 100644
index 0000000000..8e71a1d996
--- /dev/null
+++ b/activerecord/test/migrations/rename/1_we_need_things.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class WeNeedThings < ActiveRecord::Migration::Current
+ def self.up
+ create_table("things") do |t|
+ t.column :content, :text
+ end
+ end
+
+ def self.down
+ drop_table "things"
+ end
+end
diff --git a/activerecord/test/migrations/rename/2_rename_things.rb b/activerecord/test/migrations/rename/2_rename_things.rb
new file mode 100644
index 0000000000..110fe3f0fa
--- /dev/null
+++ b/activerecord/test/migrations/rename/2_rename_things.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class RenameThings < ActiveRecord::Migration::Current
+ def self.up
+ rename_table "things", "awesome_things"
+ end
+
+ def self.down
+ rename_table "awesome_things", "things"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb
new file mode 100644
index 0000000000..badccf65cc
--- /dev/null
+++ b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveHobbies < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "hobbies", :text
+ end
+
+ def self.down
+ remove_column "people", "hobbies"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb
new file mode 100644
index 0000000000..1d19d5d6f4
--- /dev/null
+++ b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveDescriptions < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "description", :text
+ end
+
+ def self.down
+ remove_column "people", "description"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy2/1_create_articles.rb b/activerecord/test/migrations/to_copy2/1_create_articles.rb
new file mode 100644
index 0000000000..85c166b319
--- /dev/null
+++ b/activerecord/test/migrations/to_copy2/1_create_articles.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class CreateArticles < ActiveRecord::Migration::Current
+ def self.up
+ end
+
+ def self.down
+ end
+end
diff --git a/activerecord/test/migrations/to_copy2/2_create_comments.rb b/activerecord/test/migrations/to_copy2/2_create_comments.rb
new file mode 100644
index 0000000000..1d213a1705
--- /dev/null
+++ b/activerecord/test/migrations/to_copy2/2_create_comments.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class CreateComments < ActiveRecord::Migration::Current
+ def self.up
+ end
+
+ def self.down
+ end
+end
diff --git a/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb
new file mode 100644
index 0000000000..d9fef596f5
--- /dev/null
+++ b/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveHobbies < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "hobbies", :string
+ end
+
+ def self.down
+ remove_column "people", "hobbies"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb
new file mode 100644
index 0000000000..badccf65cc
--- /dev/null
+++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveHobbies < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "hobbies", :text
+ end
+
+ def self.down
+ remove_column "people", "hobbies"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb
new file mode 100644
index 0000000000..1d19d5d6f4
--- /dev/null
+++ b/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class PeopleHaveDescriptions < ActiveRecord::Migration::Current
+ def self.up
+ add_column "people", "description", :text
+ end
+
+ def self.down
+ remove_column "people", "description"
+ end
+end
diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb
new file mode 100644
index 0000000000..85c166b319
--- /dev/null
+++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class CreateArticles < ActiveRecord::Migration::Current
+ def self.up
+ end
+
+ def self.down
+ end
+end
diff --git a/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb
new file mode 100644
index 0000000000..1d213a1705
--- /dev/null
+++ b/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class CreateComments < ActiveRecord::Migration::Current
+ def self.up
+ end
+
+ def self.down
+ end
+end
diff --git a/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb
new file mode 100644
index 0000000000..3bedcdcdf0
--- /dev/null
+++ b/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current
+ 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/2_we_need_reminders.rb b/activerecord/test/migrations/valid/2_we_need_reminders.rb
new file mode 100644
index 0000000000..4647268c6e
--- /dev/null
+++ b/activerecord/test/migrations/valid/2_we_need_reminders.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class WeNeedReminders < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/valid/3_innocent_jointable.rb b/activerecord/test/migrations/valid/3_innocent_jointable.rb
new file mode 100644
index 0000000000..8063bc0558
--- /dev/null
+++ b/activerecord/test/migrations/valid/3_innocent_jointable.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class InnocentJointable < ActiveRecord::Migration::Current
+ 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
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..3bedcdcdf0
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current
+ 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..4647268c6e
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class WeNeedReminders < ActiveRecord::Migration::Current
+ 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
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..8063bc0558
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class InnocentJointable < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb
new file mode 100644
index 0000000000..b938847170
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ValidWithTimestampsPeopleHaveLastNames < ActiveRecord::Migration::Current
+ 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_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb
new file mode 100644
index 0000000000..94551e8208
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class ValidWithTimestampsWeNeedReminders < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb
new file mode 100644
index 0000000000..672edc5253
--- /dev/null
+++ b/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class ValidWithTimestampsInnocentJointable < ActiveRecord::Migration::Current
+ 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
diff --git a/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb
new file mode 100644
index 0000000000..91bfbbdfd1
--- /dev/null
+++ b/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class MigrationVersionCheck < ActiveRecord::Migration::Current
+ def self.up
+ raise "incorrect migration version" unless version == 20131219224947
+ end
+
+ def self.down
+ end
+end