Hello Andrew, can you answer some questions before we get into the details?
Did you install RailsInstaller with Admin rights?
Was the command prompt used to create the application elevated (admin rights)?
Is the application using sqlite3? Is Gemfile defining it properly?
(gem "sqlite3")
> So, at this point I called upon the Gods in the IRC (thanks Wayne) who
> helped me dig into this. Running 'rake db:migrate --trace' showed the
> following:
> ** Invoke db:migrate (first _time)
> ** Invoke environment (first_time)
> ** Execute environment
> ** Execute db:migrate
> ** Invoke db:schema:dump (first_time)
> ** Invoke environment
> ** Execute db:schema:dump
> but the db is still 0kb.
And what is db/schema.rb ?
It gets created? What it contains?
> We then tried to run the migration manually from the rails console, which
> succeeded (db was now 2kb and going to http://localhost:3000/users was
> successful). So the conclusion was that everything was set up correctly
> except rake wasn't doing its job. The question is, why? In the interim,
> I'll run migrations manually but it'd be a lot nicer to understand what's
> causing this issue. (FYI, Wayne tested on Win7 and Win Vista as well and
> didn't experience this problem).
I'll try to reproduce this locally and let you know. I haven't tested
out Rails 3.0.3 or greater, so need to check what could have changed
or what could be affecting.
Will create a test application from scratch to try out.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
On Tue, Apr 19, 2011 at 11:26 AM, Andrew Jacobs <andrew...@gmail.com> wrote:Hello Andrew, can you answer some questions before we get into the details?
> In trying to get Rails running on a Vista SP2 machine where I'm not admin,
> I've turned to Railsinstaller v1.1.1 but have hit a snag--the rake tasks
> aren't working. Here's what I do (from within the Railsinstaller command
> prompt initiated from the start menu):
Did you install RailsInstaller with Admin rights?
Was the command prompt used to create the application elevated (admin rights)?
Is the application using sqlite3? Is Gemfile defining it properly?
(gem "sqlite3")
And what is db/schema.rb ?
> So, at this point I called upon the Gods in the IRC (thanks Wayne) who
> helped me dig into this. Running 'rake db:migrate --trace' showed the
> following:
> ** Invoke db:migrate (first _time)
> ** Invoke environment (first_time)
> ** Execute environment
> ** Execute db:migrate
> ** Invoke db:schema:dump (first_time)
> ** Invoke environment
> ** Execute db:schema:dump
> but the db is still 0kb.
It gets created? What it contains?
No, wanted to check that could be a permission issue.
>>
>> And what is db/schema.rb ?
>
> Andrew:
> Nothing in here other than the definition:
> ActiveRecord::Schema.define(:version => 0) do
> end
>
AFAIK, db:migrate lookups all the files in the db/migrate folder and
compare those with the database version_info table.
I smell there is a problem doing that lookup, si not finding these
files and thus, not generating or updating the schema.
Will dig into the code in a bit, refresh my memory, specific which
version of Rails is?
Will look into this at lunch time.
$ rake db:migrate RAILS_ENV=development
Again, just a wild guess.
- Ken
AFAIK, db:migrate lookups all the files in the db/migrate folder and
> Andrew:
> Nothing in here other than the definition:
> ActiveRecord::Schema.define(:version => 0) do
> end
>
compare those with the database version_info table.
I smell there is a problem doing that lookup, si not finding these
files and thus, not generating or updating the schema.
Will dig into the code in a bit, refresh my memory, specific which
version of Rails is?
Will look into this at lunch time.
I've recreated the application from scratch:
https://gist.github.com/68c040c189558b5f0220
Now, using your application, first:
https://gist.github.com/84523b8b64c314fa2c30
Can you provide me the full output of "dir db" ?
Also, you didn't have any previous sqlite3.dll hanging around
somewhere? what is the output of "where sqlite3.dll" ?
Thank you.
On Tue, Apr 19, 2011 at 1:04 PM, Andrew Jacobs <andrew...@gmail.com> wrote:I've recreated the application from scratch:
> Sure: g...@github.com:drewbono/test4_app.git
>
https://gist.github.com/68c040c189558b5f0220
Now, using your application, first:
https://gist.github.com/84523b8b64c314fa2c30
Can you provide me the full output of "dir db" ?
Also, you didn't have any previous sqlite3.dll hanging around
somewhere? what is the output of "where sqlite3.dll" ?
Can you provide me the full output of "dir db" ?
Also, you didn't have any previous sqlite3.dll hanging around
somewhere? what is the output of "where sqlite3.dll" ?No, I don't have any other sqlite3.dll's. Here' the where output:C:\Sites>where sqlite3.dllC:\RailsInstaller\Ruby1.8.7\bin\sqlite3.dll
Can you check the following?
C:\>SET VERSION
You should see this:
Environment variable VERSION not defined
===
> On Wed, Apr 20, 2011 at 12:24 PM, Andrew Jacobs <andrew...@gmail.com> wrote:
>>
>> Quick update on this. Playing around with it this morning I found that the
>> migration works fine if I explicitly tell rake to run the specific migration
>> using the "VERSION" modifier. But, if I run a 'rake db:migrate' thereafter,
>> it drops the table. Any idea what that could mean?
>> Here's what it looked like:
>> https://gist.github.com/931620
>>
>
> Can you check the following?
>
> C:\>SET VERSION
>
> You should see this:
>
> Environment variable VERSION not defined
It says:
C:\> SET VERSION
Version=Win2k
Dunno where is coming from, specially since you're not running Windows 2000.
Can you please unset that variable and try rake db:migrate again?
If that works, please remove that from your environment, or ask your
IT department to remove it.
If they don't want, just modify the batch file used by RailsInstaller
(Start Command Prompt with Ruby) and add:
SET VERSION=
That will clear up the version.
> On Thu, Apr 21, 2011 at 8:14 PM, Andrew Jacobs <andrew...@gmail.com> wrote:
>>
>>
>> It says:
>>
>> C:\> SET VERSION
>> Version=Win2k
>>
>
> Dunno where is coming from, specially since you're not running Windows 2000.
>
> Can you please unset that variable and try rake db:migrate again?
>
> If that works, please remove that from your environment, or ask your
> IT department to remove it.
>
> If they don't want, just modify the batch file used by RailsInstaller
> (Start Command Prompt with Ruby) and add:
>
> SET VERSION=
>
> That will clear up the version.
Success! I have no idea why that was keeping things from working, but as soon as I modified the .bat file to set the version to nothing, all my migrations started to work, even on the test4_app project I shared earlier. Many thanks for your persistence and sharing your expertise.
Andrew
Awesome, the reason it was affecting from things to work is hide
inside Rake and how it works.
Arguments supplied to rake in the form of VERSION=12345 are converted
into environment variables, or used environment variables if they were
set.
Is a flaw in Rake design on how to pass arguments to tasks but since
is well spread and used, cannot be removed without breaking
*everything under the sun*
When you mentioned that explicit rake db:migrate VERSION worked, it
clicked in my brain that ENV["VERSION"] was the reason.
Once you remove the environment variable, it then let the db:migrate
task work normally.
I've tested this locally using rake db:migrate VERSION=foo
VERSION gets translated into a number, so it will be zero, and that is
reverting all existing migrations. Same happen to you, Win2k (the
VERSION value) will translate to zero, and failing.
Will be great to know from where that variable is coming from, just curious.
Regards,
Cheers
Nic
http://engineyard.com
http://drnicwilliams.com
+1 (415) 322 9556
Engine Yard: Successful Rails Apps through Orchestration