我正在运行rake db:migrate给我以下警告,然后中止:
$ heroku rake db:migration --trace
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support forthese plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in …Run Code Online (Sandbox Code Playgroud) 我在Ms-Sql中有以下查询
INSERT INTO tbl_web_price_update
Select bd_book_code,
Case
When pd.bpd_price is null then
cast((a.bd_price*c.ptm_price) as numeric(10))
else
cast((pd.bpd_price*c.ptm_price) as numeric(10))
end
As Price
from tbl_books_details a
inner join tbl_price_type_master c on a.bd_price_type = c.ptm_price_type_id
left join tbl_books_price_details pd on pd.bpd_book_code = a.bd_book_code
Where c.ptm_price_type_id = @price_type
SELECT distinct r.price, STUFF((SELECT distinct ','+ Cast(a.bd_book_code as varchar) FROM tbl_web_price_update a WHERE r.price = a.price FOR XML PATH(''), TYPE).value('.','VARCHAR(max)'), 1, 1, '') FROM tbl_web_price_update r
Run Code Online (Sandbox Code Playgroud)
我已经从ms-sql迁移到my-sql,我无法在Mysql中编写替代查询.请帮忙.
我正在尝试用rails中的ruby创建一个简单的应用程序.我创建了这个脚手架:
rails generate scaffold Pic title:string content:blob description:text
Run Code Online (Sandbox Code Playgroud)
当我尝试迁移数据库时,rake db:migrate我收到此错误:
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `blob' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0xb74f8ec4>
Run Code Online (Sandbox Code Playgroud)
当我写的时候说text而不是blob正常工作.那有什么问题blob呢?
我正在使用PostgreSQL,Rails 3.1.3和Ruby 1.9.3.我正在努力使用这里db:migrate概述的.
这就是我在终端中看到的:
funkdified@funkdified-laptop:~/railsprojects/hartl$ bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== AddEmailUniquenessIndex: migrating ========================================
-- add_index(:users, :email, {:unique=>true})
Run Code Online (Sandbox Code Playgroud)
然后代码挂起.有什么想法吗?
来自:development.log
[1m[36m (0.1ms)[0m [1mSHOW search_path[0m
[1m[35m (0.5ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
Migrating to CreateUsers (20120124022843)
Migrating to AddEmailUniquenessIndex (20120124093922)
[1m[36m (0.1ms)[0m [1mBEGIN[0m
[1m[35m (3.6ms)[0m SELECT distinct i.relname, d.indisunique, d.indkey, t.oid …Run Code Online (Sandbox Code Playgroud) 我用 postgresql db 创建了一个新的 rails 5 应用程序并修改了 database.yml 文件。我成功地创建了开发和测试数据库,但是在运行迁移时只更新开发数据库,测试数据库保持不变。
这是我使用的命令列表:
rails db:create # Created both development and test
rails db:migrate # Migrated only to development
rails db:migrate RAILS_ENV=test # Does nothing (no error output)
rake db:migrate RAILS_ENV=test # Same result as above
Run Code Online (Sandbox Code Playgroud)
我的 database.yml 文件:
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: myapp_development
username: myapp_admin
password:
host: localhost
port: 5432
test:
<<: *default
database: myapp_test
username: myapp_admin
password:
host: localhost …Run Code Online (Sandbox Code Playgroud) 我试图从MySQL转储.sql文件导入数据以导入到MongoDB.但我看不到RDBMS到NoSQL数据迁移的任何机制.
我试图将数据转换为JSON and CSV但是它没有在MongoDB中提供所需的输出.
我想尝试Apache Sqoop但是它主要用于SQL或NoSQL到Hadoop.
我无法理解,如何将数据从"MySQL"迁移到"MongoDB"?
我有什么想法,除了我到现在为止尝试过的东西?
希望能听到更好,更快的解决方案.
我已经有了数据库变更管理工作流程.它基于SQL脚本(因此,它不是基于托管代码的解决方案).
基本设置如下所示:
Initial/
Generate Initial Schema.sql
Generate Initial Required Data.sql
Generate Initial Test Data.sql
Migration
0001_MigrationScriptForChangeOne.sql
0002_MigrationScriptForChangeTwo.sql
...
Run Code Online (Sandbox Code Playgroud)
启动数据库的过程是运行所有Initlal脚本,然后运行顺序迁移脚本.一个工具可以考虑版本控制要求等.
我的问题是,在这种设置中,保持这个是有用的:
Current/
Stored Procedures/
dbo.MyStoredProcedureCreateScript.sql
...
Tables/
dbo.MyTableCreateScript.sql
...
...
Run Code Online (Sandbox Code Playgroud)
"this"是指脚本目录(由对象类型分隔),表示用于旋转当前/最新版本数据库的创建脚本.
出于某种原因,我非常喜欢这个想法,但我无法具体证明它的需要.我错过了什么吗?
优点是:
缺点是:
提前感谢任何输入!
这是我在这里发表的第一篇文章.我正在尝试在Rails 3.2.1中构建我的第一个应用程序.我正在尝试使用以下终端命令为Paint生成一个脚手架:
rails generate scaffold Paint paint_family:string paint_hex:array paint_available:boolean paint_location:integer paint_quantity:integer paint_additional_info:text
Run Code Online (Sandbox Code Playgroud)
但是当我尝试迁移时,我收到以下错误:
undefined method `array' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007fbd8bdb1c58>
Run Code Online (Sandbox Code Playgroud)
这是迁移记录:
class CreatePaints < ActiveRecord::Migration
def change
create_table :paints do |t|
t.string :paint_family
t.array :paint_hex
t.boolean :paint_available
t.integer :paint_location
t.integer :paint_quantity
t.text :paint_additional_info
t.timestamps
end
end
Run Code Online (Sandbox Code Playgroud)
结束
我无法为我的生活找出原因.但那是因为我不知道自己在做什么.任何建议/帮助将不胜感激.
我正在关注RoR入门教程.创建帖子后,我现在添加第二个模型来创建评论.但是,当我尝试rake时,db:migrate我得到了这个:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `reference' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x1084a24d8>
/Users/Fryed/rails/blog/db/migrate/20120710225337_create_comments.rb:6:in `change'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `send'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `method_missing'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:458:in `method_missing'
/Users/Fryed/rails/blog/db/migrate/20120710225337_create_comments.rb:3:in `change'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `migrate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `migrate' …Run Code Online (Sandbox Code Playgroud) 我使用以下过程将本地数据库迁移到地图集
mongoexport --db bla
--collection usersettings --jsonArray --out ~/Desktop/users.json命令逐个导出db集合mongoimport --host
cluster0-shard-00-00-c7jiq.mongodb.net:27017 --db Eltar --type json
--file ~/Desktop/userotp.json --authenticationDatabase admin --ssl --username name --password pass命令在atlas上导入这些集合现在,当我连接到本地mongo shell并运行查询时,db.users.find()它显示所有记录,但是当我db.users.find()在连接atlas shell后运行相同的查询时,它只显示一条记录.
记录显示在地图集上,但无法使用查询获取它们
不知道我在这里做错了什么,任何帮助将不胜感激谢谢.