Code Monkey home page Code Monkey logo

cockroachdb-laravel's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar peterfox avatar tryvin avatar wsamoht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cockroachdb-laravel's Issues

[Bug]: Laravel 10 issue. Undefinited Method CockroachDbConnection::resetTotalQueryDuration

What happened?

The code was works fine on Laravel 8, and having issue since upgrade to Laravel 10.

It seems bunch of new static methods have been introduced in
laravel\framework\src\illuminate\Support\Facades\DB.php

Which are being pulled into
laravel\framework\src\illuminate\Queue\QueueServiceProvider.php

And as these are not available in this library, calls are failing.
Current stacktrace of failure is.

[2024-02-02 05:55:12] production.ERROR: Call to undefined method YlsIdeas\CockroachDb\CockroachDbConnection::resetTotalQueryDuration() {"exception":"[object] (Error(code: 0): Call to undefined method YlsIdeas\\CockroachDb\\CockroachDbConnection::resetTotalQueryDuration() at /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Queue/QueueServiceProvider.php:209)
[stacktrace]
#0 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(156): Illuminate\\Queue\\QueueServiceProvider->Illuminate\\Queue\\{closure}()
#1 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(138): Illuminate\\Queue\\Worker->daemon()
#2 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(121): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#3 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#4 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#5 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#6 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#7 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#8 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call()
#9 /masked-home-path/application/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#10 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#11 /masked-home-path/application/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run()
#12 /masked-home-path/application/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand()
#13 /masked-home-path/application/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun()
#14 /masked-home-path/application/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run()
#15 /masked-home-path/application/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#16 {main}
"}

How to reproduce the bug

This happens every time the task is queued using dispatch method

Package Version

1.3.0

PHP Version

8.1

Laravel Version

10

CockroachDB Version

23.1.9

Which operating systems does with happen with?

No response

Notes

No response

[Bug]: Unknown database type anyelement requested exception caused by a renaming migration

What happened?

We have a Laravel project that has the following migration steps:

  • Create column Y_temp
  • Migrate data from column X to Y_temp
  • Drop column X
  • Rename column Y_temp to X

These migrations worked without any problem on CockroachDB version 22.2.8. After updating to version 23.1.16 the renaming step from a new column to one that has been deleted previously throws the following exception:

In AbstractPlatform.php line 452:
                                                                                                                 
  Unknown database type anyelement requested, Doctrine\DBAL\Platforms\PostgreSQL100Platform may not support it.  
                                                                                                              

How to reproduce the bug

Set up a new Laravel project with CockroachDB version 23.X.X. Create migrations with the following steps:

  • Create a new table
  • Create column X
  • Create column Y
  • Drop column X
  • Rename column Y to column X

The last step should fail with the exception from above.

Package Version

1.3.0

PHP Version

8.2.0

Laravel Version

10.47.0

CockroachDB Version

23.1.6

Which operating systems does with happen with?

No response

Notes

I have already done some digging around. At first, I stumbled across this issue: doctrine/dbal#6248 with an associated PR that never got merged.
The changes in the PR worked on my machine, so it seemed to be a general bug in the Postgres implementation of doctrine. But after it tried to run the tests in the PR / write my own tests for it, I found out that it is actually not a problem with a plain PostgreSQL Database. It throws this exception only on a CRDB version above 23 and not on a plain PostgreSQL.

The SQL-Statement in the PostgreSQLSchemaManager from the selecteTableColumns-Function actually returns a different Result between CRDB Version 22, 23 and PostgreSQL 16.
In CRDB v23, it also returns the dropped fields named like this: ........pg.dropped.15...... with the type anyelement.
Doctrine now tries to cast the type anyelement which does not exist in the PostgreSQL implementation, causing the exception.

The changes in the PostgreSQLSchemaManager from the PR above does fix this issue. But i think it should not be implemented in the Doctrine DBAL 'cause it is not a PostgreSQL bug. I think we should find a way to somehow implement the fix in this package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.