运行迁移时出现以下错误。
我使用的是ruby 1.8.6版本。我们开发了插件,使ruby代码与Teradata兼容。此迁移与在后端创建Teradata表有关。
我的迁移文件:
class CreateObbPacDetails < ActiveRecord::Migration
def self.up
down
DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.create_table
end
def self.down
DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.drop_table
end
end
我的模特:
class DataWarehouse::PromotionsTradeData::ObbPacDetails < DataWarehouse::Table::Base
has_nickname :obb_pac_details
is_permanent_table
has_fields :forecast_date => "date format 'yyyy-mm-dd'",
:areacode => "byteint not null",
:bpr_regn => "char(2) not null",
:base_product_number => "integer not null",
:offer_start_date => "date format 'yyyy-mm-dd' not null",
:offer_id => "char(9) not null",
:offer_end_date => "date format 'yyyy-mm-dd' not null",
:bpr_uplift_perc => "byteint not null"
has_primary_key [:areacode, :bpr_regn, :base_product_number, :offer_start_date]
collect_stats_on :areacode
collect_stats_on :bpr_regn
collect_stats_on :base_product_number
collect_stats_on :offer_start_date
collect_stats_on [:forecast_date, :base_product_number]
错误代码:
rake db:migrate VERSION=20140328000102 --trace
(in /data/bpf/rails_dev/RB-5.2-exp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
wrong number of arguments (1 for 2)
/data/bpf/rails_dev/RB-5.2-exp/app/models/data_warehouse/promotions_trade_data/obb_pac_details.rb:29:in `has_insert_statement'
/data/bpf/rails_dev/RB-5.2-exp/app/models/data_warehouse/promotions_trade_data/obb_pac_details.rb:29
/appl/apache/dev/development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/appl/apache/dev/development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:354:in `new_constants_in'
/data/bpf/rails_dev/RB-5.2-exp/vendor/rails/activesupport/lib/active_support/dependencies.rb:509:in `require'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:81:in `require_all'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:79:in `each'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:79:in `require_all'
/data/bpf/rails_dev/RB-5.2-exp/vendor/gems/require_all-1.1.0/lib/require_all.rb:121:in `require_rel'
答案 0 :(得分:0)
在迁移过程中,您没有在DataWarehouse::PromotionsTradeData::ObbPacDetails.instance.create_table
之后为迁移提供表名。
据我所知,create_table
expects表名作为必需参数。
另外,我假设down
中的def self.up
是拼写错误。