Skip to content

Commit

Permalink
Merge pull request #331 from jolicode/database
Browse files Browse the repository at this point in the history
Move database task into database.php
  • Loading branch information
lyrixx authored Oct 24, 2024
2 parents 8833dae + 23ce8fa commit c612618
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
15 changes: 15 additions & 0 deletions .castor/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Castor\Attribute\AsTask;

use function Castor\context;
use function Castor\io;
use function docker\docker_compose;

#[AsTask(description: 'Connect to the PostgreSQL database', name: 'db:client', aliases: ['postgres', 'pg'])]
function postgres_client(): void
{
io()->title('Connecting to the PostgreSQL database');

docker_compose(['exec', 'postgres', 'psql', '-U', 'app', 'app'], context()->toInteractive());
}
10 changes: 0 additions & 10 deletions castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

use Castor\Attribute\AsTask;

use function Castor\context;
use function Castor\guard_min_version;
use function Castor\import;
use function Castor\io;
use function Castor\notify;
use function Castor\variable;
use function docker\about;
use function docker\build;
use function docker\docker_compose;
use function docker\docker_compose_run;
use function docker\generate_certificates;
use function docker\up;
Expand Down Expand Up @@ -119,11 +117,3 @@ function fixtures(): void

// docker_compose_run('bin/console doctrine:fixture:load -n');
}

#[AsTask(description: 'Connect to the PostgreSQL database', name: 'db:client', aliases: ['postgres', 'pg'])]
function postgres_client(): void
{
io()->title('Connecting to the PostgreSQL database');

docker_compose(['exec', 'postgres', 'psql', '-U', 'app', 'app'], context()->toInteractive());
}

0 comments on commit c612618

Please sign in to comment.