Skip to content

Commit

Permalink
Replace MySQL with Postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
jskowronski39 committed Oct 13, 2023
1 parent e525abf commit 1c201bc
Show file tree
Hide file tree
Showing 34 changed files with 270 additions and 1,028 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN set -eux; \
zip \
apcu \
opcache \
pdo_mysql \
pdo_pgsql \
;

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
Expand Down
5 changes: 0 additions & 5 deletions .docker/mysql/vars.env

This file was deleted.

3 changes: 3 additions & 0 deletions .docker/pgsql/vars.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_DB=af_website
POSTGRES_USER=user
POSTGRES_PASSWORD=password
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ APP_SECRET=3c0e1589d36f2c28609e4ec5af60f545
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://root@mysql:3306/af_website?serverVersion=5.7
DATABASE_URL="postgresql://user:password@pgsql:5432/af_website?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###

###> nelmio/cors-bundle ###
Expand Down
2 changes: 1 addition & 1 deletion config/doctrine/AbstractBlamableEntity.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</cascade>
</many-to-one>

<field name="lastUpdatedAt" type="datetime_immutable" nullable="true"/>
<field name="lastUpdatedAt" type="datetimetz_immutable" nullable="true"/>
<many-to-one field="lastUpdatedBy" target-entity="App\Entity\User\User">
<join-column name="last_updated_by" referenced-column-name="id"/>
<cascade>
Expand Down
2 changes: 1 addition & 1 deletion config/doctrine/AbstractEntity.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<mapped-superclass name="App\Entity\AbstractEntity">
<id name="id" type="uuid"/>
<field name="createdAt" type="datetime_immutable"/>
<field name="createdAt" type="datetimetz_immutable"/>

<indexes>
<index columns="created_at"/>
Expand Down
10 changes: 4 additions & 6 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ services:
volumes:
- './public:/www/app/public:ro'

mysql:
image: mysql:5.7
pgsql:
image: postgres:16.0-alpine
env_file:
- .docker/mysql/vars.env
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "--protocol", "tcp" ]
- .docker/pgsql/vars.env
ports:
- "33060:3306"
- "5432:5432"

imgproxy:
image: darthsim/imgproxy:v2
Expand Down
14 changes: 6 additions & 8 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ services:
- './.php-cs-fixer.dist.php:/www/app/.php-cs-fixer.dist.php:ro'
- './phpstan.neon.dist:/www/app/phpstan.neon.dist:ro'
depends_on:
- mysql
- pgsql

mysql:
image: mysql:5.7
pgsql:
image: postgres:16.0-alpine
env_file:
- .docker/mysql/vars.env
- .docker/pgsql/vars.env
environment:
MYSQL_DATABASE: 'af_website_test'
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "--protocol", "tcp" ]
POSTGRES_DB: 'af_website_test'
ports:
- "3306:3306"
- "5432:5432"
35 changes: 0 additions & 35 deletions migrations/Version20191230142218.php

This file was deleted.

38 changes: 0 additions & 38 deletions migrations/Version20200103010805.php

This file was deleted.

42 changes: 0 additions & 42 deletions migrations/Version20200123221244.php

This file was deleted.

39 changes: 0 additions & 39 deletions migrations/Version20200125110932.php

This file was deleted.

70 changes: 0 additions & 70 deletions migrations/Version20200510172618.php

This file was deleted.

Loading

0 comments on commit 1c201bc

Please sign in to comment.