2

I am learning Laravel and I have encountered a problem when I want to refresh a migration.

php artisan migrate:refresh

I am using SQlite and below is the error I am getting

 [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 5 database is locked (SQL: drop table if ex
  ists "generate_pins")

The problem seems like it comes from the SQlite having locked the database, How do I unlock the database? After I have unlocked, can I lock it again?

I am learning both Laravel and SQlite and any help will be appreciated. Thanks in advance.

2 Answers 2

2

In general, it looks like some process is using the database and it is locking the file or more likely you've made some kind of error in your code causing too many queries at the same time.

Please provide more detailed information. What OS, Laravel version, your database configuration (.env and config/database.php), your migration files and their contents, database structure (run slqite3 path/to/database.sqlite then .tables), and the contents of your migrations table (while still in sqlite run select * from migrations;).

Sign up to request clarification or add additional context in comments.

1 Comment

I have the same problem presently, my sqlite3 uses database.sqlite as its data store. I've used fuser database/database.sqlite to check the programs using the file and it turns out that it's the same laravel application. This started when I came back to the app after leaving it for a while. The same test always ran without a hitch before I came back to it.
1

In my case:

  1. Delete database.sqlite
  2. php artisan optimize:clear
  3. php artisan migrate

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.