dbmigrate

Django: How to migrate primary key to BigIntegerField of class that inherits from AbstractUser

。_饼干妹妹 提交于 2019-12-12 02:18:19
问题 I have a Django project that has numerous applications. Each application has a models.py file. I'm using this strategy to modify all the models in my project such that their primary keys are explicitly defined as id = models.BigIntegerField(primary_key=True) instead of implicitly defined as id = models.IntegerField(primary_key=True) This strategy is working well for most of my models. Except there is a problem with one model. It is my Profile model defined below: class Profile(CachingMixin,

rake db:migrate returns “rake: Is a directory”?

余生长醉 提交于 2019-12-11 12:53:41
问题 I've been searching for the answer to this question for a week, but haven't found one. I'm running Mac OS 10.5.8 if that's relevant. I'm trying to do the Peepcode tutorial "Meet Rails 3" but when I run the command line user$ rake db:migrate I get the following error message: /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake: Is a directory - /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake (Errno::EISDIR) from /usr/local/bin/rake:19:in `load' from /usr/local/bin/rake:19 I found the

Ancestry db:migrate

五迷三道 提交于 2019-12-11 11:09:16
问题 I am trying to install the Ancestry gem but I am having problems with rake db:migrate . I am following the instructions on the Ancestry github page. After I have done rails g migration add_ancestry_to_message ancestry:string I am editing the migration file (following railcast #262) to be: class AddAncestryToMessage < ActiveRecord::Migration def self.up add_column :messages, :ancestry, :string add_index :messages, :ancestry end def self.down remove_index :messages, :ancestry remove_column

rake db:migrate error (Function 'inotify_init' not found)

♀尐吖头ヾ 提交于 2019-12-09 07:13:24
问题 I just got done setting up my rails environment on my old mac book and ran into this error. I've installed FFI and rb-inotify. I've also ran bundle install again. I've looked at https://github.com/ffi/ffi/issues/66 and https://groups.google.com/forum/?fromgroups=#!topic/ruby-ffi/gj3_k34o80k which both indicate that this is a linux specific API. There is a suggestion on the second of those links that says I should just remove that gem and things that depend on it, but I am hesitant to remove

Rails: differences in db/schema.rb - null: false at created_at/updated_at columns

荒凉一梦 提交于 2019-12-05 17:28:45
问题 Does anybody know why whenever I run rake db:migrate in my production environment, the schema.rb file is changed? The differences are only on the created_at, update_at columns of all model tables: - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false I know that this is what it finds in the production db, but why were they created as null: false there and not in the development db too? 回答1: I had the same thing on my

Database Change Management - Setup for Initial Create Scripts, Subsequent Migration Scripts

泪湿孤枕 提交于 2019-12-04 06:32:16
I've got a database change management workflow in place. It's based on SQL scripts (so, it's not a managed code-based solution). The basic setup looks like this: Initial/ Generate Initial Schema.sql Generate Initial Required Data.sql Generate Initial Test Data.sql Migration 0001_MigrationScriptForChangeOne.sql 0002_MigrationScriptForChangeTwo.sql ... The process to spin up a database is to then run all the Initlal scripts, and then run the sequential Migration scripts. A tool takes case of the versioning requirements, etc. My question is, in this kind of setup, is it useful to also maintain

Rails: differences in db/schema.rb - null: false at created_at/updated_at columns

我们两清 提交于 2019-12-04 02:59:04
Does anybody know why whenever I run rake db:migrate in my production environment, the schema.rb file is changed? The differences are only on the created_at, update_at columns of all model tables: - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false I know that this is what it finds in the production db, but why were they created as null: false there and not in the development db too? I had the same thing on my dev machine. Running db:drop in production is not a wise idea, but what will fix the 'problem': rake db:drop

rake db:migrate error (Function 'inotify_init' not found)

拟墨画扇 提交于 2019-12-03 10:04:12
I just got done setting up my rails environment on my old mac book and ran into this error. I've installed FFI and rb-inotify. I've also ran bundle install again. I've looked at https://github.com/ffi/ffi/issues/66 and https://groups.google.com/forum/?fromgroups=#!topic/ruby-ffi/gj3_k34o80k which both indicate that this is a linux specific API. There is a suggestion on the second of those links that says I should just remove that gem and things that depend on it, but I am hesitant to remove FFI which seems to depend on it. What course of action do you suggest? Any advice on this matter is

How to make rake db:migrate generate schema.rb when using :sql schema format

半城伤御伤魂 提交于 2019-12-01 03:44:43
If using the this option in config/application.rb : config.active_record.schema_format = :sql then when you do: rake db:migrate it only dumps the db/structure.sql . I know it isn't using the db/schema.rb since it is using the :sql option, but how can you make rake db:migrate generate db/schema.rb also? We need that because RubyMine 4.5 and IntelliJ IDea 11 use db/schema.rb for autocompletion of columns. To generate/update db/schema.rb even if using the :sql option, you can put this in your Rakefile : Rake::Task["db:migrate"].enhance do if ActiveRecord::Base.schema_format == :sql Rake::Task["db

Heroku rake db:migrate results in Error R13 (Attach error) -> Failed to attach to process

两盒软妹~` 提交于 2019-11-30 18:18:55
I have a rails app on heroku that i am unable to run my latest database changes with. Running heroku run rake db:migrate gives me Running `rake db:migrate` attached to terminal... up, run.3167 ! Heroku client internal error. ! Search for help at: https://help.heroku.com ! Or report a bug at: https://github.com/heroku/heroku/issues/new Error: Operation timed out - connect(2) (Errno::ETIMEDOUT) Backtrace: /Users/gregg/.heroku/client/lib/heroku/client/rendezvous.rb:40:in `initialize' /Users/gregg/.heroku/client/lib/heroku/client/rendezvous.rb:40:in `open' /Users/gregg/.heroku/client/lib/heroku