mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #369 from acelaya/feature/postgres-query-error
Feature/postgres query error
This commit is contained in:
commit
f563e777cc
23
CHANGELOG.md
23
CHANGELOG.md
@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
|
## 1.16.2 - 2019-03-05
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
* *Nothing*
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
* [#368](https://github.com/shlinkio/shlink/issues/368) Fixed error produced when running a `SELECT COUNT(...)` with `ORDER BY` in PostgreSQL databases.
|
||||||
|
|
||||||
|
|
||||||
## 1.16.1 - 2019-02-26
|
## 1.16.1 - 2019-02-26
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
2
data/infra/database_pg/.gitignore
vendored
Executable file
2
data/infra/database_pg/.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
@ -1,6 +0,0 @@
|
|||||||
FROM mysql:5.7
|
|
||||||
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
|
||||||
|
|
||||||
# Enable remote access (default is localhost only, we change this
|
|
||||||
# otherwise our database would not be reachable from outside the container)
|
|
||||||
RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf
|
|
@ -1,5 +0,0 @@
|
|||||||
FROM nginx:1.11.6-alpine
|
|
||||||
MAINTAINER Alejandro Celaya <alejandro@alejandrocelaya.com>
|
|
||||||
|
|
||||||
# Delete default nginx vhost
|
|
||||||
RUN rm /etc/nginx/conf.d/default.conf
|
|
@ -28,6 +28,9 @@ RUN docker-php-ext-install zip
|
|||||||
RUN apk add --no-cache --virtual libpng-dev
|
RUN apk add --no-cache --virtual libpng-dev
|
||||||
RUN docker-php-ext-install gd
|
RUN docker-php-ext-install gd
|
||||||
|
|
||||||
|
RUN apk add --no-cache postgresql-dev
|
||||||
|
RUN docker-php-ext-install pdo_pgsql
|
||||||
|
|
||||||
# Install redis extension
|
# Install redis extension
|
||||||
ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz
|
ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz
|
||||||
RUN mkdir -p /usr/src/php/ext/redis\
|
RUN mkdir -p /usr/src/php/ext/redis\
|
||||||
|
@ -27,6 +27,9 @@ RUN docker-php-ext-install zip
|
|||||||
RUN apk add --no-cache --virtual libpng-dev
|
RUN apk add --no-cache --virtual libpng-dev
|
||||||
RUN docker-php-ext-install gd
|
RUN docker-php-ext-install gd
|
||||||
|
|
||||||
|
RUN apk add --no-cache postgresql-dev
|
||||||
|
RUN docker-php-ext-install pdo_pgsql
|
||||||
|
|
||||||
# Install redis extension
|
# Install redis extension
|
||||||
ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz
|
ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz
|
||||||
RUN mkdir -p /usr/src/php/ext/redis\
|
RUN mkdir -p /usr/src/php/ext/redis\
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
shlink_php:
|
shlink_php:
|
||||||
@ -12,3 +12,15 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /etc/passwd:/etc/passwd:ro
|
- /etc/passwd:/etc/passwd:ro
|
||||||
- /etc/group:/etc/group:ro
|
- /etc/group:/etc/group:ro
|
||||||
|
|
||||||
|
shlink_db:
|
||||||
|
user: 1000:1000
|
||||||
|
volumes:
|
||||||
|
- /etc/passwd:/etc/passwd:ro
|
||||||
|
- /etc/group:/etc/group:ro
|
||||||
|
|
||||||
|
shlink_db_postgres:
|
||||||
|
user: 1000:1000
|
||||||
|
volumes:
|
||||||
|
- /etc/passwd:/etc/passwd:ro
|
||||||
|
- /etc/group:/etc/group:ro
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
version: '2'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
shlink_nginx:
|
shlink_nginx:
|
||||||
container_name: shlink_nginx
|
container_name: shlink_nginx
|
||||||
build:
|
image: nginx:1.15.9-alpine
|
||||||
context: .
|
|
||||||
dockerfile: ./data/infra/nginx.Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- "8000:80"
|
- "8000:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/home/shlink/www
|
- ./:/home/shlink/www
|
||||||
- ./docs:/home/shlink/www/public/docs
|
- ./docs:/home/shlink/www/public/docs
|
||||||
- ./data/infra/vhost.conf:/etc/nginx/conf.d/shlink-vhost.conf
|
- ./data/infra/vhost.conf:/etc/nginx/conf.d/default.conf
|
||||||
links:
|
links:
|
||||||
- shlink_php
|
- shlink_php
|
||||||
|
|
||||||
@ -25,6 +23,7 @@ services:
|
|||||||
- ./data/infra/php.ini:/usr/local/etc/php/php.ini
|
- ./data/infra/php.ini:/usr/local/etc/php/php.ini
|
||||||
links:
|
links:
|
||||||
- shlink_db
|
- shlink_db
|
||||||
|
- shlink_db_postgres
|
||||||
|
|
||||||
shlink_swoole:
|
shlink_swoole:
|
||||||
container_name: shlink_swoole
|
container_name: shlink_swoole
|
||||||
@ -37,12 +36,11 @@ services:
|
|||||||
- ./:/home/shlink
|
- ./:/home/shlink
|
||||||
links:
|
links:
|
||||||
- shlink_db
|
- shlink_db
|
||||||
|
- shlink_db_postgres
|
||||||
|
|
||||||
shlink_db:
|
shlink_db:
|
||||||
container_name: shlink_db
|
container_name: shlink_db
|
||||||
build:
|
image: mysql:5.7
|
||||||
context: .
|
|
||||||
dockerfile: ./data/infra/db.Dockerfile
|
|
||||||
ports:
|
ports:
|
||||||
- "3307:3306"
|
- "3307:3306"
|
||||||
volumes:
|
volumes:
|
||||||
@ -51,3 +49,16 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: root
|
MYSQL_ROOT_PASSWORD: root
|
||||||
MYSQL_DATABASE: shlink
|
MYSQL_DATABASE: shlink
|
||||||
|
|
||||||
|
shlink_db_postgres:
|
||||||
|
container_name: shlink_db_postgres
|
||||||
|
image: postgres:10.7-alpine
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
volumes:
|
||||||
|
- ./:/home/shlink/www
|
||||||
|
- ./data/infra/database_pg:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: root
|
||||||
|
POSTGRES_DB: shlink
|
||||||
|
PGDATA: /var/lib/postgresql/data/pgdata
|
||||||
|
@ -50,7 +50,8 @@ DQL;
|
|||||||
?int $offset = null
|
?int $offset = null
|
||||||
): array {
|
): array {
|
||||||
$qb = $this->createVisitsByShortCodeQueryBuilder($shortCode, $dateRange);
|
$qb = $this->createVisitsByShortCodeQueryBuilder($shortCode, $dateRange);
|
||||||
$qb->select('v');
|
$qb->select('v')
|
||||||
|
->orderBy('v.date', 'DESC');
|
||||||
|
|
||||||
if ($limit !== null) {
|
if ($limit !== null) {
|
||||||
$qb->setMaxResults($limit);
|
$qb->setMaxResults($limit);
|
||||||
@ -76,8 +77,7 @@ DQL;
|
|||||||
$qb->from(Visit::class, 'v')
|
$qb->from(Visit::class, 'v')
|
||||||
->join('v.shortUrl', 'su')
|
->join('v.shortUrl', 'su')
|
||||||
->where($qb->expr()->eq('su.shortCode', ':shortCode'))
|
->where($qb->expr()->eq('su.shortCode', ':shortCode'))
|
||||||
->setParameter('shortCode', $shortCode)
|
->setParameter('shortCode', $shortCode);
|
||||||
->orderBy('v.date', 'DESC') ;
|
|
||||||
|
|
||||||
// Apply date range filtering
|
// Apply date range filtering
|
||||||
if ($dateRange !== null && $dateRange->getStartDate() !== null) {
|
if ($dateRange !== null && $dateRange->getStartDate() !== null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user