Skip to content

Commit 380d894

Browse files
authored
Fix for pgsql notifications table (alexjustesen#191)
1 parent f2c6498 commit 380d894

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

database/migrations/2022_10_24_152031_create_notifications_table.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@ public function up()
1717
$table->uuid('id')->primary();
1818
$table->string('type');
1919
$table->morphs('notifiable');
20-
$table->text('data');
20+
21+
/**
22+
* PostgreSQL doesn't support "text" column type so we need to use the 'json' type instead.
23+
*
24+
* Docs: https://filamentphp.com/docs/2.x/notifications/database-notifications
25+
*/
26+
if (env('DB_CONNECTION') == 'pgsql') {
27+
$table->json('data');
28+
} else {
29+
$table->text('data');
30+
}
31+
2132
$table->timestamp('read_at')->nullable();
2233
$table->timestamps();
2334
});

docker-compose.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,47 @@ services:
2323
networks:
2424
- sail
2525
depends_on:
26+
# - mysql
27+
# - pgsql
2628
- mailhog
29+
# mysql:
30+
# image: 'mysql/mysql-server:8.0'
31+
# ports:
32+
# - '${FORWARD_DB_PORT:-3306}:3306'
33+
# environment:
34+
# MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
35+
# MYSQL_ROOT_HOST: "%"
36+
# MYSQL_DATABASE: '${DB_DATABASE}'
37+
# MYSQL_USER: '${DB_USERNAME}'
38+
# MYSQL_PASSWORD: '${DB_PASSWORD}'
39+
# MYSQL_ALLOW_EMPTY_PASSWORD: 1
40+
# volumes:
41+
# - 'sail-mysql:/var/lib/mysql'
42+
# - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
43+
# networks:
44+
# - sail
45+
# healthcheck:
46+
# test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
47+
# retries: 3
48+
# timeout: 5s
49+
# pgsql:
50+
# image: 'postgres:14'
51+
# ports:
52+
# - '${FORWARD_DB_PORT:-5432}:5432'
53+
# environment:
54+
# PGPASSWORD: '${DB_PASSWORD:-secret}'
55+
# POSTGRES_DB: '${DB_DATABASE}'
56+
# POSTGRES_USER: '${DB_USERNAME}'
57+
# POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
58+
# volumes:
59+
# - 'sail-pgsql:/var/lib/postgresql/data'
60+
# - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'
61+
# networks:
62+
# - sail
63+
# healthcheck:
64+
# test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"]
65+
# retries: 3
66+
# timeout: 5s
2767
mailhog:
2868
image: 'mailhog/mailhog:latest'
2969
ports:
@@ -34,3 +74,8 @@ services:
3474
networks:
3575
sail:
3676
driver: bridge
77+
# volumes:
78+
# sail-mysql:
79+
# driver: local
80+
# sail-pgsql:
81+
# driver: local

0 commit comments

Comments
 (0)