Skip to content

Commit 6a20992

Browse files
committed
Added config and migrations
1 parent 3b5ab60 commit 6a20992

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed

config/packages/doctrine.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
doctrine:
2+
dbal:
3+
url: '%env(resolve:DATABASE_URL)%'
4+
5+
# IMPORTANT: You MUST configure your server version,
6+
# either here or in the DATABASE_URL env var (see .env file)
7+
#server_version: '5.7'
8+
orm:
9+
auto_generate_proxy_classes: true
10+
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
11+
auto_mapping: true
12+
mappings:
13+
App:
14+
is_bundle: false
15+
type: annotation
16+
dir: '%kernel.project_dir%/src/Entity'
17+
prefix: 'App\Entity'
18+
alias: App
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
doctrine_migrations:
2+
migrations_paths:
3+
# namespace is arbitrary but should be different from App\Migrations
4+
# as migrations classes should NOT be autoloaded
5+
'DoctrineMigrations': '%kernel.project_dir%/migrations'

config/packages/prod/doctrine.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
doctrine:
2+
orm:
3+
auto_generate_proxy_classes: false
4+
metadata_cache_driver:
5+
type: pool
6+
pool: doctrine.system_cache_pool
7+
query_cache_driver:
8+
type: pool
9+
pool: doctrine.system_cache_pool
10+
result_cache_driver:
11+
type: pool
12+
pool: doctrine.result_cache_pool
13+
14+
framework:
15+
cache:
16+
pools:
17+
doctrine.result_cache_pool:
18+
adapter: cache.app
19+
doctrine.system_cache_pool:
20+
adapter: cache.system

config/services.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ services:
4545
bind:
4646
string $botUsername: '%env(BOT_USERNAME)%'
4747

48+
_instanceof:
49+
App\Service\TaskHandler\TaskHandlerInterface:
50+
tags: ['app.task_handlers']
51+
4852
App\:
4953
resource: '../src/*'
5054
exclude: '../src/{DependencyInjection,Subscriber,Kernel.php,GitHubEvents.php}'
@@ -90,3 +94,7 @@ services:
9094
class: App\Subscriber\MilestoneNewPRSubscriber
9195
arguments:
9296
$ignoreCurrentVersion: true
97+
98+
App\Service\TaskRunner:
99+
arguments:
100+
$handlers: !tagged_iterator app.task_handlers

migrations/Version20201103191534.php

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20201103191534 extends AbstractMigration
14+
{
15+
public function getDescription() : string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema) : void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('CREATE SEQUENCE task_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
24+
$this->addSql('CREATE TABLE task (id INT NOT NULL, repository_full_name VARCHAR(255) NOT NULL, number INT NOT NULL, action INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, verify_after TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
25+
$this->addSql('COMMENT ON COLUMN task.created_at IS \'(DC2Type:datetime_immutable)\'');
26+
$this->addSql('COMMENT ON COLUMN task.updated_at IS \'(DC2Type:datetime_immutable)\'');
27+
$this->addSql('COMMENT ON COLUMN task.verify_after IS \'(DC2Type:datetime_immutable)\'');
28+
}
29+
30+
public function down(Schema $schema) : void
31+
{
32+
// this down() migration is auto-generated, please modify it to your needs
33+
$this->addSql('DROP SEQUENCE task_id_seq CASCADE');
34+
$this->addSql('DROP TABLE task');
35+
}
36+
}

0 commit comments

Comments
 (0)