gpt4 book ai didi

ruby-on-rails - 创建表而不在 db/migrate rails 中指定

转载 作者:数据小太阳 更新时间:2023-10-29 07:39:32 27 4
gpt4 key购买 nike

我的 article.rb 模型在 rails 中有以下结构

 property :artikelnummer, type: 'string', index: 'not_analyzed'
property :eannummer, type: 'string', index: 'not_analyzed'

property :bezeichnung, type: 'multi_field', fields: {
bezeichnung: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'},
suggest: {:type => 'string', :analyzer => 'suggest_analyzer'}
}

property :bezeichnung_zusatz, type: 'multi_field', fields: {
bezeichnung_zusatz: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :matchcode, type: 'string', index: 'not_analyzed'

property :mengeneinheit, type: 'string', include_in_all: false

property :gewicht, type: 'float', include_in_all: false

property :hersteller, type: 'multi_field', fields: {
hersteller: {type: 'string'},
unchanged: {type: 'string', :index => 'not_analyzed'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :hersteller_nummer, type: 'string', index: 'not_analyzed', include_in_all: false

property :hersteller_artikelnummer, type: 'string', index: 'not_analyzed'

property :gruppe, type: 'multi_field', fields: {
gruppe: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :gruppe_zusatz, type: 'multi_field', fields: {
gruppe_zusatz: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :gruppe_nummer, type: 'string', index: 'not_analyzed', include_in_all: false

#property :hauptgruppe, type: 'multi_field', fields: {
# hauptgruppe: {type: 'string'},

# ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'} #

 # TODO: n-level facet
property :hierarchie, type: 'multi_field', fields: {
hierarchie: {type: 'string', index_analyzer: 'hierarchie_index_analyzer', search_analyzer: 'keyword', include_in_all: false},
ngram: {type: 'string', index_analyzer: 'ngram_index_analyzer', search_analyzer: 'ngram_search_analyzer'}
}

property :langtext, type: 'multi_field', fields: {
langtext: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :infotext, type: 'multi_field', fields: {
infotext: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}
}

property :bestelltext, type: 'multi_field', fields: {
bestelltext: {type: 'string'},
ngram: {:type => 'string', :index_analyzer => 'ngram_index_analyzer', :search_analyzer => 'ngram_search_analyzer'}

    property :dimension, type: 'string', include_in_all: false

property :listenpreis_netto, type: 'float', index: 'not_analyzed', include_in_all: false

property :listenpreis_brutto, type: 'float', index: 'not_analyzed', include_in_all: false

是否有任何方法可以根据上述信息创建表迁移文件不存在于 db/migrations..如果是,那么如何完成

提前致谢

编辑 我能问的最简单的方法

i want above information in my database how can i do it

最佳答案

我不熟悉在 ActiveRecord 中使用 Mongo。 (Mongoid?);但是我确实使用原始 Ruby gem 来使用 Mongo。在 Mongo 中没有模式的概念(具有固定的表/列);当您编写这些时,mongo 集合和文档就会出现。所以我不确定你真的会用迁移做什么。也许使用这些来预填充集合?

关于ruby-on-rails - 创建表而不在 db/migrate rails 中指定,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21754656/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com