Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning for timestamps and Activerecord #2019

Closed
wikimatze opened this issue Apr 6, 2016 · 2 comments
Closed

Deprecation warning for timestamps and Activerecord #2019

wikimatze opened this issue Apr 6, 2016 · 2 comments
Milestone

Comments

@wikimatze
Copy link
Member

Simple create a migration and run the migration:

padrino rake db:migrate
WARN: Unresolved specs during Gem::Specification.reset:
      activesupport (>= 3.1)
      tilt (< 3, >= 1.3)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
=> Executing Rake db:migrate ...
WARNING! In Padrino >= 0.14.0 cli command `padrino rake` will NOT add
'./lib' folder to $LOAD_PATH. Please alter your `require` calls accordingly
if you depend on this behavior.
  DEBUG -  ActiveRecord::SchemaMigration Load (0.1ms)  SELECT "schema_migrations".* FROM "schema_migrations"
   INFO -  Migrating to CreatePosts (2)
  DEBUG -   (0.0ms)  begin transaction
== 2 CreatePosts: migrating ===================================================
-- create_table(:posts)
DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in up at /tmp/sample_admin_slim_error/db/migrate/002_create_posts.rb:6)

Should we just add null: true in migrations with timestamps? I got rid of the warning by turning

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.string :name
      t.text :body
      t.timestamps
    end
  end

  def self.down
    drop_table :posts
  end
end

Into

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.string :name
      t.text :body
      t.timestamps null: false
    end
  end

  def self.down
    drop_table :posts
  end
end

What's your opinion? If it's a yes, I try to implement it. You can read more about it under http://juanitofatas.com/2015/01/28/rails-5-timestamps/

@ujifgc
Copy link
Member

ujifgc commented May 2, 2016

If it's about changing padrino-gen, I think we should add :null => false as it's the new default.

@wikimatze
Copy link
Member Author

Okay, I'll prepare the pull-request (to get more familiar in working more with the source-code and flow).

@ujifgc ujifgc added this to the 0.13.2 milestone May 4, 2016
nesquena added a commit that referenced this issue May 9, 2016
…mp-warnings

Remove deprecation warning for ActiveRecord, fixes #2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants