diff --git a/migrations/Version20250709073312.php b/migrations/Version20250709073312.php new file mode 100644 index 0000000..ebcd01b --- /dev/null +++ b/migrations/Version20250709073312.php @@ -0,0 +1,35 @@ +addSql('CREATE TABLE subscriptions (id SERIAL NOT NULL, users_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_4778A0167B3B43D ON subscriptions (users_id)'); + $this->addSql('ALTER TABLE subscriptions ADD CONSTRAINT FK_4778A0167B3B43D FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE subscriptions DROP CONSTRAINT FK_4778A0167B3B43D'); + $this->addSql('DROP TABLE subscriptions'); + } +} diff --git a/migrations/Version20250709073752.php b/migrations/Version20250709073752.php new file mode 100644 index 0000000..5c373d5 --- /dev/null +++ b/migrations/Version20250709073752.php @@ -0,0 +1,35 @@ +addSql('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))'); + $this->addSql('CREATE INDEX IDX_98F5228767B3B43D ON user_tab (users_id)'); + $this->addSql('ALTER TABLE user_tab ADD CONSTRAINT FK_98F5228767B3B43D FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE user_tab DROP CONSTRAINT FK_98F5228767B3B43D'); + $this->addSql('DROP TABLE user_tab'); + } +} diff --git a/migrations/Version20250709115309.php b/migrations/Version20250709115309.php new file mode 100644 index 0000000..df0c50b --- /dev/null +++ b/migrations/Version20250709115309.php @@ -0,0 +1,37 @@ +addSql('DROP SEQUENCE subscriptions_id_seq CASCADE'); + $this->addSql('ALTER TABLE subscriptions DROP CONSTRAINT fk_4778a0167b3b43d'); + $this->addSql('DROP TABLE subscriptions'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('CREATE SEQUENCE subscriptions_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE subscriptions (id SERIAL NOT NULL, users_id INT NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX idx_4778a0167b3b43d ON subscriptions (users_id)'); + $this->addSql('ALTER TABLE subscriptions ADD CONSTRAINT fk_4778a0167b3b43d FOREIGN KEY (users_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } +} diff --git a/migrations/Version20250709120951.php b/migrations/Version20250709120951.php new file mode 100644 index 0000000..36b3e75 --- /dev/null +++ b/migrations/Version20250709120951.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE organizations ADD name VARCHAR(255) NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE organizations DROP name'); + } +} diff --git a/migrations/Version20250709121023.php b/migrations/Version20250709121023.php new file mode 100644 index 0000000..5c7deef --- /dev/null +++ b/migrations/Version20250709121023.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE organizations ADD name VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE organizations DROP name'); + } +} diff --git a/src/Entity/Organizations.php b/src/Entity/Organizations.php index 8bd00cb..967e388 100644 --- a/src/Entity/Organizations.php +++ b/src/Entity/Organizations.php @@ -42,6 +42,9 @@ class Organizations #[ORM\ManyToMany(targetEntity: Apps::class, mappedBy: 'organization')] private Collection $apps; + #[ORM\Column(length: 255, nullable: true)] + private ?string $name = null; + public function __construct() { $this->apps = new ArrayCollection(); @@ -162,4 +165,16 @@ class Organizations return $this; } + + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): static + { + $this->name = $name; + + return $this; + } }