]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
add pgsql config to db.php
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 11 Mar 2024 13:24:35 +0000 (16:24 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 11 Mar 2024 13:24:35 +0000 (16:24 +0300)
docker-compose.yml
docker/db/dev.db-pgsql.env
erp24/config/db.php
erp24/web/index.php

index c7e71345ea117dafa067c39cf35c3dacd49d9658..ba28e91bcad4bd258cb4b1abfd5b18b682eefd96 100644 (file)
@@ -41,7 +41,8 @@ services:
     extra_hosts:
       - "host.docker.internal:host-gateway"
     env_file:
-      - docker/php/dev.php.env
+      - docker/php/dev.php.
+      - docker/db/dev.db-pgsql.env
     environment:
       MODE: 'dev'
     volumes:
index 02b040b39af1ab91677aed0ef3704eef13109751..f6c696d6d30bf88ba637d6523a033196b4fea085 100644 (file)
@@ -2,4 +2,7 @@ POSTGRES_USER=root
 POSTGRES_PASSWORD=root
 PGADMIN_DEFAULT_EMAIL=admin@admin.com
 PGADMIN_DEFAULT_PASSWORD=admin
-POSTGRES_DB=erp24
\ No newline at end of file
+POSTGRES_DB=erp24
+POSTGRES_HOSTNAME=db-pgsql-yii_erp24
+POSTGRES_PORT=5432
+POSTGRES_SCHEMA=erp24
\ No newline at end of file
index a1e430bc06e2f068d9d7326d48b3b30f044f94c3..1dde7260730e33c905bd005bd6c1a26eb8a77053 100644 (file)
@@ -1,6 +1,24 @@
 <?php
 
-return [
+return 1 == 2 ? [
+    'class' => yii\db\Connection::class,
+    'dsn' => strtr('pgsql:host={host};port={port};dbname={dbname}', [
+        '{host}' => getenv('POSTGRES_HOSTNAME') ?: '127.0.0.1',
+        '{port}' => getenv('POSTGRES_PORT') ?: 3306,
+        '{dbname}' => getenv('POSTGRES_SCHEMA') ?: 'erp24',
+    ]),
+    'username' => getenv('POSTGRES_USER') ?: 'bazacvetov24',
+    'password' => getenv('POSTGRES_PASSWORD') ?: 'JVJruro_Xdg456o3ir',
+    'schemaMap' => [
+        'pgsql' => [
+            'class' => 'yii\db\pgsql\Schema',
+            'defaultSchema' => 'erp24' //specify your schema here, public is the default schema
+        ]
+    ], // PostgreSQL
+//    'charset' => 'utf8',
+//    'enableSchemaCache' => true,
+//    'schemaCacheDuration' => 300,
+]: [
     'class' => yii\db\Connection::class,
     'dsn' => strtr('mysql:host={host};port={port};dbname={dbname}', [
         '{host}' => getenv('DB_HOST') ?: '127.0.0.1',
index c13ebe82656ae9d7fa4f40e79d5d4aeb68a24be6..c3ac62eefceec64a593705d582c2685ddadd2346 100644 (file)
@@ -15,6 +15,6 @@ Yii::setAlias('@dist', dirname(__DIR__) . '/dist');
 $app = (new yii\web\Application($config));
 
 $app->params['API2_TOKEN'] = $app->db->createCommand(
-    'SELECT access_token FROM api_user WHERE login="erp" LIMIT 1;')->queryAll()[0]['access_token'] ?? null;
+    'SELECT access_token FROM api_user WHERE "login"=\'erp\' LIMIT 1;')->queryAll()[0]['access_token'] ?? null;
 
 $app->run();