I just git cloned from the Laravel repo and setup the pgSQL database details. Next I tried using artisan
to create the session
table.
php artisan session:table
However that gives me the following error:
X-Powered-By: PHP/5.3.16
Content-type: text/html
<br />
<b>Fatal error</b>: Uncaught exception 'Laravel\Database\Exception' with message 'SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "sessions" does not exist
LINE 1: SELECT * FROM "sessions" WHERE "id" = $1 LIMIT 1
^
SQL: SELECT * FROM "sessions" WHERE "id" = ? LIMIT 1
Bindings: array (
0 => 'i8qwmexP1joUkSLDH7naRayJDiSrLFGQa4xeubgz',
)' in /home/dev/public_html/laravel/database/connection.php:263
Stack trace:
#0 /home/dev/public_html/laravel/database/connection.php(183): Laravel\Database\Connection->execute('SELECT * FROM "...', Array)
#1 /home/dev/public_html/laravel/database/query.php(648): Laravel\Database\Connection->query('SELECT * FROM "...', Array)
#2 /home/dev/public_html/laravel/database/query.php(592): Laravel\Database\Query->get(Array)
#3 /home/dev/public_html/laravel/database/query.php(563): Laravel\Database\Query->first(Array)
#4 /home/dev/public_html/laravel/session/drivers/database.php(36): Laravel\Database\Query->find('i8qwmexP1joUkSL...')
#5 /home/dev/public_html/laravel/session/dri in <b>/home/dev/public_html/laravel/database/connection.php</b> on line <b>263</b><br />
When I switched the database driver to mysql
I get the following message:
X-Powered-By: PHP/5.3.16
Content-type: text/html
You forgot to provide the task name.
Executing the SQL query works though, while artisan
does not.
CREATE TABLE `sessions` (
`id` VARCHAR(40) NOT NULL,
`last_activity` INT(10) NOT NULL,
`data` TEXT NOT NULL,
PRIMARY KEY (`id`)
);
How should I solve this error when pgSQL driver is used? Not sure what went wrong here.
Try removing the single quotes from your query:
CREATE TABLE sessions (
id VARCHAR(40) NOT NULL,
last_activity INT(10) NOT NULL,
data TEXT NOT NULL,
PRIMARY KEY (id)
);