Squelette Symfony, entités Server et Action
This commit is contained in:
commit
52ecb4204c
46 changed files with 4308 additions and 0 deletions
38
migrations/Version20260417000002.php
Normal file
38
migrations/Version20260417000002.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
final class Version20260417000002 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add server_access table: per-user SSH credentials per server';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE server_access (
|
||||
access_id SERIAL NOT NULL,
|
||||
server_id INT NOT NULL,
|
||||
user_id INT NOT NULL,
|
||||
ssh_user VARCHAR(50) NOT NULL,
|
||||
ssh_password TEXT NOT NULL,
|
||||
PRIMARY KEY(access_id),
|
||||
CONSTRAINT uq_server_user UNIQUE (server_id, user_id)
|
||||
)');
|
||||
$this->addSql('ALTER TABLE server_access
|
||||
ADD CONSTRAINT FK_sa_server FOREIGN KEY (server_id) REFERENCES server (server_id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE server_access
|
||||
ADD CONSTRAINT FK_sa_user FOREIGN KEY (user_id) REFERENCES app_user (user_id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('DROP TABLE server_access');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue