При выполнении следующей миграции
class EnableUuid < ActiveRecord::Migration[6.0]
def change
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
add_column :properties, :uuid, :uuid, default: "gen_random_uuid()", null: false
end
end
... я получаю эту ошибку:
Malformed version number string 12.2 (Ubuntu 12.2-2.pgdg18.04+1)
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/checker.rb:305:in `target_version'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/checker.rb:268:in `postgresql_version'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/checker.rb:83:in `perform'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/migration.rb:9:in `method_missing'
/home/deploy/os/releases/20200405142659/db/migrate/20200405135611_add_uuid_to_properties.rb:3:in `change'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:828:in `exec_migration'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:811:in `block in migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `with_connection'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:810:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/migration.rb:5:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1001:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1311:in `block in execute_migration_in_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1362:in `block in ddl_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/transactions.rb:212:in `transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1362:in `ddl_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1310:in `execute_migration_in_transaction'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1282:in `block in migrate_without_lock'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1281:in `each'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1281:in `migrate_without_lock'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1229:in `block in migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1229:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1061:in `up'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/migration.rb:1036:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/strong_migrations-0.6.1/lib/strong_migrations/database_tasks.rb:4:in `migrate'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/railties/databases.rake:84:in `each'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.2.1/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/bugsnag-6.12.2/lib/bugsnag/integrations/rake.rb:19:in `execute'
/home/deploy/os/shared/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/home/deploy/.rbenv/versions/2.6.5/bin/bundle:23:in `load'
/home/deploy/.rbenv/versions/2.6.5/bin/bundle:23:in `<main>'
Самое странное, что такая же миграция работает на моей локальной машине, но не на рабочем сервере. Оба сервера работают под управлением pg 12.X, и я могу подтвердить, что pgcrypto включен.
Спасибо!