Refactor( delete userTab )

This commit is contained in:
Charles 2025-07-04 11:11:18 +02:00
parent 9e77511702
commit b3c75ba21f
2 changed files with 53 additions and 66 deletions

View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250704091028 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
DROP SEQUENCE user_tab_id_seq CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user_tab DROP CONSTRAINT fk_98f5228767b3b43d
SQL);
$this->addSql(<<<'SQL'
DROP TABLE user_tab
SQL);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
CREATE SCHEMA public
SQL);
$this->addSql(<<<'SQL'
CREATE SEQUENCE user_tab_id_seq INCREMENT BY 1 MINVALUE 1 START 1
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE user_tab (id SERIAL NOT NULL, users_id INT NOT NULL, ip_address VARCHAR(255) NOT NULL, tab_id VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))
SQL);
$this->addSql(<<<'SQL'
CREATE INDEX idx_98f5228767b3b43d ON user_tab (users_id)
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user_tab ADD CONSTRAINT fk_98f5228767b3b43d FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE
SQL);
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\UserTabRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: UserTabRepository::class)]
class UserTab
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?User $users = null;
#[ORM\Column]
private ?String $ipAddress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tabId = null;
public function getId(): ?int
{
return $this->id;
}
public function getUsers(): ?User
{
return $this->users;
}
public function setUsers(?User $users): static
{
$this->users = $users;
return $this;
}
public function getIpAddress(): ?String
{
return $this->ipAddress;
}
public function setIpAddres(String $ipAddress): static
{
$this->ipAddress = $ipAddress;
return $this;
}
public function getTabId(): ?string
{
return $this->tabId;
}
public function setTabId(?string $tabId): static
{
$this->tabId = $tabId;
return $this;
}
}