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

Support PostgreSQL #36

Open
titoshadow opened this issue Mar 13, 2020 · 4 comments
Open

Support PostgreSQL #36

titoshadow opened this issue Mar 13, 2020 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@titoshadow
Copy link

titoshadow commented Mar 13, 2020

Really cool package, I see a huge potential here !
Let's keep it rolling :)

Model edition or features alike are not working, because commands like 'describe' do not exist on PostgreSQL

[2020-03-13 10:05:23] local.ERROR: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "describe"
LINE 1: describe "work_orders"
        ^ (SQL: describe "work_orders") {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42601): SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near \"describe\"
LINE 1: describe \"work_orders\"
        ^ (SQL: describe \"work_orders\") at /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669)
[stacktrace]
#0 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\\Database\\Connection->runQueryCallback()
#1 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\\Database\\Connection->run()
#2 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(349): Illuminate\\Database\\Connection->select()
#3 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Database\\DatabaseManager->__call()
#4 /var/www/html/someweb/vendor/mtolhuys/laravel-schematics/src/Http/Controllers/ModelsController.php(62): Illuminate\\Support\\Facades\\Facade::__callStatic()
#5 [internal function]: Mtolhuys\\LaravelSchematics\\Http\\Controllers\\ModelsController->columns()
#6 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array()
#7 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction()
#8 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#9 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\\Routing\\Route->runController()
#10 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Routing\\Route->run()
#11 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#12 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#13 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(683): Illuminate\\Pipeline\\Pipeline->then()
#14 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Router->runRouteWithinStack()
#15 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\\Routing\\Router->runRoute()
#16 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Routing/Router.php(613): Illuminate\\Routing\\Router->dispatchToRoute()
#17 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(170): Illuminate\\Routing\\Router->dispatch()
#18 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#19 /var/www/html/someweb/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#20 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#21 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#23 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#25 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#27 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#28 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle()
#29 /var/www/html/someweb/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#30 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\\Proxy\\TrustProxies->handle()
#31 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#32 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Pipeline\\Pipeline->then()
#33 /var/www/html/someweb/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#34 /var/www/html/someweb/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle()
#35 {main}
@mtolhuys mtolhuys added the enhancement New feature or request label Mar 13, 2020
@mtolhuys
Copy link
Owner

Oh yeah! High on my list as well. Difficult to do since I'm not having a good PostgreSQL setup here at the moment.

@mtolhuys mtolhuys added the help wanted Extra attention is needed label Mar 13, 2020
@titoshadow
Copy link
Author

What do you need, or what is your testing environment so I can prepare a PostgreSQL deployment for you? Would like to lend a hand :)

@mtolhuys
Copy link
Owner

Help would be hugely appreciated. Right now I only have a Ubuntu 18.04 with mysql 5.7 setup. Haven't ever set up postgresql for personal use. So even though this one probably will be very minor to test it would be a challenge for me.

@titoshadow
Copy link
Author

titoshadow commented Apr 23, 2020

Well these are some easy steps to get a PostgreSQL 12 up and running on Ubuntu 18.04:

This block will import GPG keys and add PG12 repos, then install:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get -y install postgresql-12 postgresql-client-12

It should have started up, just check with:

systemctl status postgresql

as usually.

From here, it becomes quite similar to MySQL (just better? :D)
Assuming you are working local, thus no need to edit pg_hba.conf, just open a psql session and build up some foundation:

sudo su - postgres
psql
CREATE DATABASE whatever;
CREATE USER whatafancyuser WITH ENCRYPTED PASSWORD 'soSecureSuchWow';
GRANT ALL PRIVILEGES ON DATABASE whatever TO whatafancyuser;

Aaaaand you are good to go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants