aejnsn / postgresify

Extended PostgreSQL Functionality for Laravel and Lumen.
MIT License
26 stars 11 forks source link

Schema bind statement error #11

Open ha17 opened 8 years ago

ha17 commented 8 years ago

I'm getting a "protocol violation" error if I add your provider to the "providers" array in config/app.php and then run php artisan migrate:refresh --seed. PHP7, Postgres 9.4, Laravel 5.3.17. Without the provider, it runs fine.

From [https://www.postgresql.org/docs/8.1/static/errcodes-appendix.html](Postgres documentation):

08P01   PROTOCOL VIOLATION  protocol_violation
[Illuminate\Database\QueryException]                                                                                           
  SQLSTATE[08P01]: \Unknown error>>: 7 ERROR:  bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000003"    
  requires 2 (SQL: select * from information_schema.tables where table_schema = migrations and table_name = ?)
[Doctrine\DBAL\Driver\PDOException]                                                                                            
  SQLSTATE[08P01]: \Unknown error>>: 7 ERROR:  bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000003"    
  requires 2
[PDOException]                                                                                                                 
  SQLSTATE[08P01]: \Unknown error>>: 7 ERROR:  bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000003"    
  requires 2  
terra-yi commented 8 years ago

aejnsn/postgresify/src/Database/Schema/Builder.php

This class should now extends PostgresBuilder instead of Builder at least on Laravel 5.3

rommelandrea commented 7 years ago

same problem. same solution. Please fix it

aejnsn commented 7 years ago

Sorry about this guys. I have not noticed this issue. I'll jump into fixing this and prepping for newer versions of Laravel today or tomorrow.

ryanrapini commented 6 years ago

Any status on this?

terra-yi commented 6 years ago

My interim workaround was to use cweagans/composer-patches to apply patch automatically on composer require/update, because it is not right to edit directly in composer package manually. You should first

composer require --save cweagans/composer-patches

to install the package, edit composer.json

...
    "extra": {
        ....
        "patches": {
            "aejnsn/postgresify": {
                "Laravel 5.3.x compatibility": "patches/postgresify_laravel_5_3_compat.patch"
            }
        }
...

and create postgresify_laravel_5_3_compat.patch under [project_root]/patches directory (you should create one) with following diff

diff --git original/src/Database/Schema/Builder.php postgresify/src/Database/Schema/Builder.php
index 18ac9be..aab08dc 100644
--- original/src/Database/Schema/Builder.php
+++ postgresify/src/Database/Schema/Builder.php
@@ -3,7 +3,7 @@
 namespace Aejnsn\Postgresify\Database\Schema;

 use Closure;
-use Illuminate\Database\Schema\Builder as BaseBuilder;
+use Illuminate\Database\Schema\PostgresBuilder as BaseBuilder;

 class Builder extends BaseBuilder
 {

Now if you composer require/update the postgresify package, it should be patched to work on Laravel >= 5.3.

At least it works for me.

ryanrapini commented 6 years ago

We just forked the repo and applied the fix, following these instructions to apply it in composer.

I was just asking if there is any status on the main developer patching the code for the newer versions of Laravel

ghurtadoarevalo commented 6 years ago

There's an update for this?

erickcg commented 6 years ago

I think this another repo is the maintained version https://packagist.org/packages/martimarkov/postgresify

martimarkov commented 6 years ago

Yeah, I need more functionality to this so I started working on it. Loved the name so decided to keep it. I've been adding what i need when i need it but am open to requests by anyone.

@ghurtadoarevalo @erickcg