niceseb's avatar

QueryException in Connection.php line 647: Database (/database/database.sqlite) does not exist. (SQL: select * from "products"

Now that I have removed database(and all subfolders seeds/migrations/factories) completely by mistake. How to revert back to refresh installed status as php artisan migrate no longer works... I tried to manually add back those folders and files from another project but does not work anymore?

EDIT: Solved, i just need to find out why after adding items in sqlite, broswer shows

QueryException in Connection.php line 647: Database (/database/database.sqlite) does not exist. (SQL: select * from "products")

0 likes
9 replies
tykus's avatar

I suppose since you are asking that you have not been using a version control system?

Next, ask yourself do you need the migrations files at all if you are not using version control in the first instance? Your database is already existing, so that is your "truth".

If you really must have them (e.g. to run integration tests) then you could utilise a package to reverse engineer them, e.g. https://github.com/Xethron/migrations-generator

frezno's avatar

@niceseb You always can try to undelete (restore) the deleted files using appropriate tool(s), since the files aren't deleted physically from your disk but just have been made unvisible.

niceseb's avatar

Thanks I have been able to generate new migration files, but upon viewing in video 'Dynamically Populating Checkout Modal' after 2:59

App\Product::createForce(...)

was created, I checked in browser and I get

QueryException in Connection.php line 647: Database (database/database.sqlite) does not exist. (SQL: select * from "products")

tykus's avatar

So, create that file and run your migrations.

$ touch database/database.sqlite
$ php artisan migrate
niceseb's avatar

Hi tykus,

I already did both of these commands just now, and although migration was successful, when i went to the browser, the above message is what was observed.

tykus's avatar

If you are seeing this message QueryException in Connection.php line 647: Database (database/database.sqlite) does not exist. (SQL: select * from "products") but your migrations successfully ran, then there is something else missing.

thc1967's avatar

I can't help you solve THIS problem, but I can help you solve the root cause.

Learn GIT and use it. I don't believe you have to necessarily push to a repo to gain the benefits of source control since it keeps a local repo for you.

Check in (git commit) early, check in often.

Good luck with the deleted files!

niceseb's avatar

Hi thc1967, I am able to migrate ok now, but still getting:

QueryException in Connection.php line 647: Database (database/database.sqlite) does not exist. (SQL: select * from "products")

BTW, I already committed into github so not sure how your statement of source control relate to database/database.sqlite not found issue.

tykus's avatar

Can you give some more information about your environment, i.e. .env? It is incongruous that your migrations are running successfully and you are getting that error. If your database is missing, then the migrations should not run without an error.

Please or to participate in this conversation.