From b3c75ba21fb366dc42145fd291a9942771d0b26e Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 4 Jul 2025 11:11:18 +0200 Subject: [PATCH] Refactor( delete userTab ) --- migrations/Version20250704091028.php | 53 ++++++++++++++++++++++ src/Entity/UserTab.php | 66 ---------------------------- 2 files changed, 53 insertions(+), 66 deletions(-) create mode 100644 migrations/Version20250704091028.php delete mode 100644 src/Entity/UserTab.php diff --git a/migrations/Version20250704091028.php b/migrations/Version20250704091028.php new file mode 100644 index 0000000..f030d7f --- /dev/null +++ b/migrations/Version20250704091028.php @@ -0,0 +1,53 @@ +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); + } +} diff --git a/src/Entity/UserTab.php b/src/Entity/UserTab.php deleted file mode 100644 index 1e7ef8d..0000000 --- a/src/Entity/UserTab.php +++ /dev/null @@ -1,66 +0,0 @@ -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; - } -}