问题标签 [dbmigrate]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby-on-rails - ruby on rails - git 存储库,数据库处理
- 我目前正在使用 Bitbucket,并且正在跨用户处理 Ruby on Rails 存储库。默认情况下,当一个用户推送存储库(默认命令 - git push origin master -entire rails 文件夹)时,我假设数据库也被推送到位桶,对吗?
- 当第二个用户从 git 下载存储库时,我不应该期望所有 db 文件也被下载吗?
- 下载文件后,第二个用户是否需要再次运行 rake db migrate 命令?
在上述特定情况下,我是第二个用户,在从 BitBucket 下载存储库时收到以下错误消息,而文件在上传者计算机上完美运行:
ActiveRecord::StatementInvalid 在 StaticPagesController#home
找不到表“用户”
我想确保我们俩都在同一个数据库上工作,而不是在不同的数据集上并行工作。
ruby-on-rails - Rails 应用程序,安装 Devise,rake db:migrate 错误
尝试重新安装设计。Postgresql 上的 Rails 4
我已按照 Devise 的说明进行操作(例如添加 devise gem/bundle install)并对我的环境/application.rb/添加了我的 flash 消息进行了更改
然后跑了
rails generate devise User
并得到了这个...
但问题是当我尝试运行时rake db:migrate
出现此错误
== AddDeviseToUsers: migrating ===============================================
-- change_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "users" does not exist
: ALTER TABLE "users" ADD COLUMN "email" character varying(255) DEFAULT '' NOT NULL/Users/name/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in exec'
所以我知道错误告诉我不存在表“用户”,但设计应该创建这个,所以我的主要问题是......解决这个问题的最简单方法是什么?
另外,为什么不设计这个?这会导致未来的问题吗?
我是否应该在 postgres 中创建一个用户表,然后在设计中再次运行该命令并让它更改必要的文件并“设计”它?(如果它甚至会这样做)
谢谢!
yii - Yii 迁移命令问题
我已按照此分步说明使用 migrate 命令在我的数据库中创建一个表,但我想知道它是如何在最后一步完成的。运行“ yiic migrate ”命令后,我收到以下消息:
我不知道我必须在它之后运行什么命令以及如何完成迁移过程!
有人对此问题有解决方案吗?(我也在使用Windows 7)
ruby-on-rails - Heroku run rake 是什么意思?
当我去heroku run rake
Rake 的时候被中止了,下一行说,Don't know how to build task 'default'
跑heroku run rake --trace
了,得到了
这个错误是什么意思?
ruby-on-rails - change_column 类型中的 rails 3 迁移错误
我正在尝试更改列类型并出现错误。我的模型是Conf
,列名是xml
。我想把它从 更改:file
为:binary
。xml
最初创建为text
,然后我将其更改为file
与此非常相似的类似迁移文件。我想再次做同样的事情并将类型更改为binary
但出现错误。
有迁移文件:
这是错误:
rake db:rollback
-- change_column(:confs, :xml, :text)
以“ ”开头给出相同的错误
ruby-on-rails - rake db:迁移问题 postgresql
我完全是 PostgreSQL 的菜鸟,Ruby on Rails ..
我正在尝试遵循本教程(没有 rubymine)http://www.codeproject.com/Articles/575551/User-Authentication-in-Ruby-on-Rails#InstallingRubyMine4
我有这样的迁移(001_create_user_model.rb):
我得到的错误是这样的:
mysql - Rails:db/schema.rb 中的差异 - null:在 created_at/updated_at 列中为 false
有谁知道为什么每当我rake db:migrate
在生产环境中运行时,schema.rb 文件都会更改?
差异仅在所有模型表的 created_at、update_at 列上:
我知道这是它在生产数据库中找到的,但为什么它们是在null: false
那里创建的,而不是在开发数据库中创建的呢?
ruby-on-rails - 迁移 DB Rails 时出错
我正在尝试使用此迁移,但我不断收到错误,例如这些
这是我的迁移文件
当我尝试执行 rake db:migrate 得到这个错误:
== CreateEmployees:迁移 ============================================== === -- create_table(:employees) rake 中止!发生错误,此迁移和所有后续迁移均已取消:
SQLite3::SQLException: 表 "employees" 已经存在: CREATE TABLE "employees" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar (255), "hiredate" date, "salary" float, "fulltime" boolean默认't',“假期”整数,“评论”文本)/Library/Ruby/Gems/2.0.0/gems/sql ite3-1.3.8/lib/sqlite3/database.rb:91:in
initialize' /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:in
new'/Library /Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:91:inprepare' /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.8/lib/sqlite3/database.rb:134:in
执行' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib /active_record/connection_adapters/sqlite3_adapter.rb:328:inblock in execute' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:425:in
block in log' /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:420:in
log'/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:328:inexecute' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:190:in
create_table' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:625:inblock in method_missing' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:597:in
block in say_with_time' /Library/Ruby/Gems/2.0.0/gems/activerecord -4.0.0/lib/active_record/migration.rb:597:insay_with_time' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:617:in
method_missing' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:383:inmethod_missing' /Users/YuriAguirre/Documents/Aptana Studio 3 Workspace/company/db/migrate/20130923140626_create_employees.rb:3:in
up' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:534:inup' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:574:in
exec_migration' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0 /lib/active_record/migration.rb:555:inblock (2 levels) in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:554:in
block in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:inwith_connection' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:553:in
迁移' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:709:inmigrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:959:in
块中的 execute_migration_in_transaction' /Library/Ruby/Gems/2.0.0/gems/activerecord -4.0.0/lib/active_record/migration.rb:1005:block in ddl_transaction' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in
在事务块中'/Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements。 rb:210:inwithin_new_transact ion' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in
transaction' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:intransaction' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:1005:in
ddl_transaction' /Library/Ruby/Gems/2.0.0/ gems/activerecord-4.0.0/lib/active_record/migration.rb:958:inexecute_migration_in_transaction' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:920:in
block in migrate' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb: 916:在each' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:916:in
迁移' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:inup' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in
迁移' /Library/Ruby/Gems/2.0.0/gems/activerecord-4.0 .0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in ' Tasks: TOP => db:migrate (通过使用 --trace 运行任务查看完整跟踪)
ruby-on-rails - 似乎无法使用开发数据库
我更新了我的 database.yml 文件,如下所示:
现在看来,当我运行我的应用程序并注册一个新用户时,开发数据库没有插入新用户......
注册新用户的测试全部通过
ruby-on-rails - 如何判断 rake db:migrate 和 rake db:seed 是否成功
Ruby rake db:seed aborting due to ** Execute db:abort_if_pending_migrations,但我认为所有迁移都成功了。
这是我运行 rake db:migrate --trace 时输出的最后一部分
我认为这意味着它是成功的(我没有看到任何中止)?
然后当我运行 rake db:seed --trace 我得到(总结):
(插件加载没有错误)然后:
这是否意味着迁移和种子是否正常工作?感谢您的时间和投入!