laravel-currency: Table doesn't exist on installing

After this: php artisan vendor:publish --provider="Torann\Currency\CurrencyServiceProvider"

I receive this:

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sistemaimobiliario.currencies' doesn't exist (SQL: select * from `currencies`)

[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sistemaimobiliario.currencies' doesn't exist 

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I’m looking into this now. From what I remember I ran into this problem with another project I had and fixed it.

I just released a new version. http://lyften.com/projects/laravel-currency/doc/upgrade.html

It uses a middleware to handle currency switching so the database isn’t trying to be called when the app boots.

Indeed!

As a temporary fix I am overriding the getCacheCurrencies and have the below condition:

    if ((App::runningInConsole() && ! App::runningUnitTests()) || (App::runningUnitTests() && !Schema::hasTable('currencies'))) {
        return ...
    }
    return parent::getCacheCurrencies();

You’re right. The Problem is the getCacheCurrencies() function which is calling the all method of the driver.

A simple if ($this->database->hasTable($table)) would solve the issue. But I don’t know the code of this bundle so @Torann should decide ^^.