diff --git a/database/migrations/2022_10_24_152031_create_notifications_table.php b/database/migrations/2022_10_24_152031_create_notifications_table.php index 4357c9efa..73c65725f 100644 --- a/database/migrations/2022_10_24_152031_create_notifications_table.php +++ b/database/migrations/2022_10_24_152031_create_notifications_table.php @@ -17,7 +17,18 @@ public function up() $table->uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); - $table->text('data'); + + /** + * PostgreSQL doesn't support "text" column type so we need to use the 'json' type instead. + * + * Docs: https://filamentphp.com/docs/2.x/notifications/database-notifications + */ + if (env('DB_CONNECTION') == 'pgsql') { + $table->json('data'); + } else { + $table->text('data'); + } + $table->timestamp('read_at')->nullable(); $table->timestamps(); }); diff --git a/docker-compose.yml b/docker-compose.yml index 18916931b..072fc1a18 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,47 @@ services: networks: - sail depends_on: + # - mysql + # - pgsql - mailhog + # mysql: + # image: 'mysql/mysql-server:8.0' + # ports: + # - '${FORWARD_DB_PORT:-3306}:3306' + # environment: + # MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' + # MYSQL_ROOT_HOST: "%" + # MYSQL_DATABASE: '${DB_DATABASE}' + # MYSQL_USER: '${DB_USERNAME}' + # MYSQL_PASSWORD: '${DB_PASSWORD}' + # MYSQL_ALLOW_EMPTY_PASSWORD: 1 + # volumes: + # - 'sail-mysql:/var/lib/mysql' + # - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' + # networks: + # - sail + # healthcheck: + # test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] + # retries: 3 + # timeout: 5s + # pgsql: + # image: 'postgres:14' + # ports: + # - '${FORWARD_DB_PORT:-5432}:5432' + # environment: + # PGPASSWORD: '${DB_PASSWORD:-secret}' + # POSTGRES_DB: '${DB_DATABASE}' + # POSTGRES_USER: '${DB_USERNAME}' + # POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}' + # volumes: + # - 'sail-pgsql:/var/lib/postgresql/data' + # - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql' + # networks: + # - sail + # healthcheck: + # test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"] + # retries: 3 + # timeout: 5s mailhog: image: 'mailhog/mailhog:latest' ports: @@ -34,3 +74,8 @@ services: networks: sail: driver: bridge +# volumes: + # sail-mysql: + # driver: local + # sail-pgsql: + # driver: local