Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] SQLite Database Type no longer supported #128

Open
michaellindahl opened this issue Jun 13, 2022 · 0 comments
Open

[Bug] SQLite Database Type no longer supported #128

michaellindahl opened this issue Jun 13, 2022 · 0 comments

Comments

@michaellindahl
Copy link
Contributor

michaellindahl commented Jun 13, 2022

Describe the bug
Prior to the release that added the 2021_08_23_082401_increase_long_url_length migration, UrlHum worked great on installations that used SQLite. I've used this so that when deploying on shared hosting, the application doesn't have to make a network request to an external MySQL server and instead can just make a filesystem request. I understand under high loads this may be sub optional. It would be great if SQLite and MySQL could both be supported.

To Reproduce
Run php artisan migrate. See:

Migrating: 2021_08_23_082401_increase_long_url_length

   Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 1 near "DROP": syntax error (SQL: ALTER TABLE `urls` DROP INDEX `urls_long_url_unique`;)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

  1   [internal]:0
      Illuminate\Database\Schema\Blueprint::__construct("urls", Object(Closure), "")

      +7 vendor frames 
  9   database/migrations/2021_08_23_082401_increase_long_url_length.php:17
      Illuminate\Support\Facades\Facade::__callStatic("statement")

Removing this line corrects it:

DB::statement('ALTER TABLE `urls` DROP INDEX `urls_long_url_unique`;');

But there is still this issue when visiting a page:

Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 1 near "`short_url`": syntax error (SQL: select "urls".*, (select count(*) from "clicks" where "urls"."short_url" = "clicks"."short_url") as "clicks_count", (select count(*) from "clicks" where "urls"."short_url" = "clicks"."short_url" and "real_click" = 1) as "real_clicks_count", (select count(*) from "clicks" where "urls"."short_url" = "clicks"."short_url" and "created_at" >= 2022-06-12 05:52:15) as "today_clicks_count" from "urls" where BINARY `short_url` = wholesale limit 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant