SQLite3 DB migration Doesn't show up

rails
sqlite

#1

Rails Tutorial Michael H. (rails -v 4.2.2)

Objective: Get schema.rb and add_column_password_digest to update and show on SQLite3 browser; however, it seems to not update the SQLite3 browser.

 $ rails generate migration add_password_digest_to_users password_digest:string
  invoke  active_record
  create    db/migrate/20160109023342_add_password_digest_to_users.rb

(The command above runs fine, meaning it does indeed create the migration.)

class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
end
end

(The code above, is the actual migration file created by the previous command.)

$ bundle exec rake db:migrate
== 20160109023342 AddPasswordDigestToUsers: migrating ====================
-- add_column(:users, :password_digest, :string)
-> 0.0096s
== 20160109023342 AddPasswordDigestToUsers: migrated (0.0097s) ================

(Then I run the command above)

As shown, it should theoretically add_column to sqlite3 db right?

Also, I will include the schema.rb

ActiveRecord::Schema.define(version: 20160109023342) do

create_table "users", force: :cascade do |t|
t.string   "name"
t.string   "email"
t.datetime "created_at",      null: false
t.datetime "updated_at",      null: false
t.string   "password_digest"
end

add_index "users", ["email"], name: "index_users_on_email", unique: true

end

(The version is equal to that of the add_password_digest_to_users.rb but yet schema migration in the sqlite3 db does not update either.)

Yes, I have tried everything from making sure syntax was right, running this command rake

db:migrate VERSION=20160109023342

and last but not least checking out this thread Ruby on Rails - sqlite 3 rake migrations not updating the database

Lastly, I do have the gemfile copied right off the tutorial correctly… check it out

source 'https://rubygems.org'

group :development, :test do
gem 'sqlite3',     '1.3.9'
gem 'byebug',      '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring',      '1.1.3'
end

From the info given and given that I also copied Michael’s tutorial exactly, what am I missing or adding on that is causing the sqlite3 db to not update or dsplay any of the new commands??

Thank You.


#2

Hi,

Thank you for writing in. Can you also check the database.yml to see if the path to the SQLite3 database is correct?

Regards,
​Mutahhir


#3

Hi,

Thanks for your quick responses Mutahhir; I truly appreciate it.

SQlite in dev env, has to be continually downloaded to the local disk in order to see the updated databases…
That was the issue. :slightly_smiling:

Regards