Skip to content

Commit

Permalink
fix: remove User::roles from database
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Mar 28, 2024
1 parent ac56982 commit ede2ff2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/migrations/Version20230906094949.php
Expand Up @@ -41,7 +41,7 @@ public function up(Schema $schema): void
$this->addSql('COMMENT ON COLUMN review.user_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN review.book_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN review.published_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE "user" (id UUID NOT NULL, email VARCHAR(255) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, roles JSON NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE "user" (id UUID NOT NULL, email VARCHAR(255) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649E7927C74 ON "user" (email)');
$this->addSql('COMMENT ON COLUMN "user".id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921DA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
Expand Down
5 changes: 1 addition & 4 deletions api/src/Entity/User.php
Expand Up @@ -85,9 +85,6 @@ class User implements UserInterface
#[ORM\Column]
public ?string $lastName = null;

#[ORM\Column(type: 'json')]
public array $roles = [];

public function getId(): ?Uuid
{
return $this->id;
Expand All @@ -102,7 +99,7 @@ public function eraseCredentials(): void
*/
public function getRoles(): array
{
return $this->roles;
return ['ROLE_USER'];
}

public function getUserIdentifier(): string
Expand Down

0 comments on commit ede2ff2

Please sign in to comment.