Skip to content

Commit

Permalink
Feature / Database and workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
glavvra4 committed Dec 17, 2023
1 parent e26b988 commit d15580b
Show file tree
Hide file tree
Showing 11 changed files with 301 additions and 30 deletions.
7 changes: 4 additions & 3 deletions app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ TZ=Europe/Moscow

# Postgres settings
POSTGRES_HOST_SOCKET=postgres
POSTGRES_DB=POSTGRES_DB
POSTGRES_USER=POSTGRES_USER
POSTGRES_PASSWORD=POSTGRES_PASSWORD
POSTGRES_PORT=5432
POSTGRES_DB=wizle
POSTGRES_USER=wizle
POSTGRES_PASSWORD=change_me

# Telegram Bot Api settings
TELEGRAM_BOT_API_TIMEOUT_SECONDS=60
Expand Down
2 changes: 2 additions & 0 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"symfony/http-client": "6.2.*",
"symfony/monolog-bundle": "^3.10",
"symfony/runtime": "6.2.*",
"symfony/workflow": "6.2.*",
"symfony/yaml": "6.2.*"
},
"config": {
Expand Down Expand Up @@ -75,6 +76,7 @@
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "6.2.*",
"symfony/css-selector": "6.2.*",
"symfony/maker-bundle": "^1.50",
"symfony/phpunit-bridge": "^6.2"
}
}
241 changes: 240 additions & 1 deletion app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
];
26 changes: 0 additions & 26 deletions app/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,13 @@ doctrine:
dbname: '%env(POSTGRES_DB)%'
driver: 'pdo_pgsql'
default_connection: docker
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
connection: docker
mappings:
App:
type: attribute
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

when@test:
doctrine:
dbal:
dbname_suffix: '_test%env(default::TEST_TOKEN)%'

when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool

framework:
cache:
pools:
Expand Down
2 changes: 2 additions & 0 deletions app/config/packages/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
framework:
workflows:
29 changes: 29 additions & 0 deletions app/migrations/Version20231217204759.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20231217204759 extends AbstractMigration
{
public function getDescription(): string
{
return 'Create customers table';
}

public function up(Schema $schema): void
{
$this->addSql('CREATE SEQUENCE "customer_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE "customer" (id INT NOT NULL, telegram_id INT NOT NULL, current_place VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
}

public function down(Schema $schema): void
{
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE "customer_id_seq" CASCADE');
$this->addSql('DROP TABLE "customer"');
}
}
Loading

0 comments on commit d15580b

Please sign in to comment.