Remove faulty migration generation

The long timestamps don't play well with Rails default timestamps for
migrations. They are always seen as the newest. Not using long
timestamps leads to duplicate timestamps though.

The better solution is to use `rails generate migration` and copy the
`change` method.
This commit is contained in:
Maikel Linke
2024-01-15 11:36:21 +11:00
parent 0a5982bb8f
commit 301add4992

View File

@@ -60,11 +60,6 @@ RSpec.describe "Database" do
puts migrations.join("\n")
puts "\nTo disable this warning, add the class name(s) of the model(s) to models_todo " \
"in #{__FILE__}"
return if ENV.fetch("OFN_WRITE_FOREIGN_KEY_MIGRATIONS", false)
puts "Migrations have not been written to disk. To write migrations to disk, please " \
"add OFN_WRITE_FOREIGN_KEY_MIGRATIONS=true to the file .env.test.local"
end
def process_association(model_class, association)
@@ -104,9 +99,6 @@ RSpec.describe "Database" do
migration_name = "add_foreign_key_to_#{model_class.table_name}_" \
"#{foreign_key_table_name}_#{foreign_key_column}"
migration_class_name = migration_name.camelize
millisecond_timestamp = generate_timestamp
migration_file_name = "db/migrate/#{millisecond_timestamp}_" \
"#{migration_name}.rb"
orphaned_records_query = generate_orphaned_records_query(model_class, foreign_key_table_name,
foreign_key_column)
@@ -122,11 +114,6 @@ RSpec.describe "Database" do
end
MIGRATION
if ENV.fetch("OFN_WRITE_FOREIGN_KEY_MIGRATIONS", false)
File.open(migration_file_name, 'w') do |file|
file.puts migration
end
end
migration
end