2
votes

I've recently installed homestead and am definitely a beginner at this. With that said, I've installed Homestead as per the 5.2 tutorial, installed Laravel, and have begun to follow the tutorials. Everything has been going well until I get to the part where I am switching the database to sqlite3 and doing a migration. I have been stuck there. I'll explain the circumstances as detailed as possible.

I'm using Windows 8. I've installed homestead. homestead is installed in C:\Users\Joe. My Laravel folder is in C:\laravel\Sites The current site I'm working on is in C:\laravel\Sites\test\

I've modified the .env, DB_DATABASE to; "DB_DATABASE=storage/database.sqlite".

Inside the Homestead.yaml file, I've modified the database to storage/database.sqlite.

I've opened git bash inside C:\laravel\Sites\test I used the "touch storage/database.sqlite" command.

Joe@JOEALAI /C/laravel/Sites/test $ touch storage/database.sqlite $

Then I use the

php artisan migrate

command inside git bash and it tells me:

Joe@JOEALAI /C/laravel/Sites/test $ php artisan migrate Migrated: 2014_1012000000_create_users_table Migrated: 2014_10_12_100000_create_password_resets_table $

Therefore I know that it's being created. I've also checked the file inside the storage/ folder, and database.sqlite

Now, the next part is to type "sqlite3" into the same git bash that I just used to do that migration, and it says the following:

Joe@JOEALAI /C/laravel/Sites/test $ sqlite3 sh: sqlite3: command not found $

So what I've done next is gone into homestead and typed in sqlite3, and I actually get a response:

vagrant@homestead:~$ sqlite3
SQLite version 3.8.2 2013-12-06 14:53:30 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>

Next I've done what he said and types in .tables. It gives me the following:

sqlite> .tables sqlite>

Nothing happens.

Next I type in .databases and this is the response I get.

sqlite> .databases seq name file

0 main
sqlite>

so I hit ctrl+z, and then type in:

vagrant@homestead:~$ sqlite3 storage/database.sqlite

It then says:

SQLite version 3.8.2 2013-12-06 14:53:30 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite>

I then type in: .tables and it says

Error: unable to open database "storage/database.sqlite": unable to open database file

I repeat the same thing with .databases Same error.

What am I missing? I'm racking my brain on this. I've been stuck here for over an entire week. First I tried using WAMP, and I got the same problem except never had ANY response because I didn't have homestead installed. Now I have installed homestead and am using it, and it's still not working.

I thought maybe I had to do ALL of these commands within the vagrant box. I've gone into homestead vagrant box and tried to do a

php artisan migrate

command and it tells me

vagrant@homestead:~$ php artisan migrate Could not open input file: artisan vagrant@homestead:

Just for arguments sakes, I'll provide some of the data in my configuration files

DB_CONNECTION=sqlite DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=storage/database.sqlite DB_USERNAME=homestead DB_PASSWORD=secret

My Homestead.yaml file:

ip: "192.168.10.10" memory: 2048 cpus: 1 provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys: - ~/.ssh/id_rsa

folders: - map: C:/laravel/Sites to: /home/vagrant/Sites

sites: - map: lol.app to: /home/vagrant/Sites/test/public

databases: - database

database.php

'default' => env('DB_CONNECTION', 'sqlite'),
'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', ],

If anyone can please help me figure out how to get this set up, I'd greatly appreciate it. If you need any more information I'd be happy to supply it.

Thank you!

1

1 Answers

2
votes

Alright, so after messing with it for a while longer, I've figured out the solution.

On the tutorial video, it tells me to type sqlite3 storage/database.sqlite (which is the 'touch storage/database.sqlite' file that i've created.

When I type this command it, it does not give me an error.

HOWEVER

I was browsing through sqlite3 commands and I eventually used a command where it showed me the current directory. I got there by typing:

sqlite3

sqlite3> .open database.sqlite

sqlite3> .databases

and it displayed

seq     name       file
0     main       /home/vagrant/database.sqlite

and BOOM I finally saw the problem.

"/home/vagrant/database.sqlite" should have been /home/vagrant/Sites/test/storage/database.sqlite

So all I had to do was type

sqlite3 Sites/test/storage/database.sqlite

and it navigated to the correct folder.

Now when I type in .tables it shows me

migrations         password resets    users

which is the desired result.

Took me long enough! I almost gave up! I REALLY hope this helps someone.