From ff06a2656a6dd48e7a060889de32b7dd914373e5 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Mon, 7 Mar 2022 15:47:52 +0000 Subject: [PATCH] [COMPONENT][Group][Entity] Useless URI column removed Add table to Makefile backup --- Makefile | 26 +++++++++++++++++++------ components/Group/Entity/GroupMember.php | 20 ++----------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index db19c14ab9..e5420cb853 100644 --- a/Makefile +++ b/Makefile @@ -83,9 +83,16 @@ backup-actors: sh -c 'su postgres -c "mkdir -p /tmp/backup"' && \ docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \ sh -c "cd /var/www/social && bin/console doctrine:query:sql \"\ - copy actor to '/tmp/backup/actor.csv'; copy local_user to '/tmp/backup/local_user.csv';\ - copy activitypub_actor to '/tmp/backup/ap_actor.csv'; copy activitypub_rsa to '/tmp/backup/ap_rsa.csv';\ - copy actor_subscription to '/tmp/backup/actor_subscription.csv'; copy local_group to '/tmp/backup/local_group.csv';\ + copy actor to '/tmp/backup/actor.csv';\ + copy local_user to '/tmp/backup/local_user.csv';\ + copy local_group to '/tmp/backup/local_group.csv';\ + \ + copy activitypub_actor to '/tmp/backup/ap_actor.csv';\ + copy activitypub_rsa to '/tmp/backup/ap_rsa.csv';\ + \ + copy actor_subscription to '/tmp/backup/actor_subscription.csv';\ + copy group_member to '/tmp/backup/group_member.csv';\ + \ copy feed to '/tmp/backup/feed.csv';\ copy (SELECT 'ALTER SEQUENCE ' || c.relname || ' RESTART WITH ' || nextval(c.relname::regclass) || ';'\ FROM pg_class c WHERE c.relkind = 'S') to '/tmp/backup/sequences';\"" && \ @@ -97,9 +104,16 @@ restore-actors: docker exec -it $(call translate-container-name,$(strip $(DIR))_db_1) sh -c 'chown postgres /tmp/backup' && \ docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \ sh -c "cd /var/www/social && bin/console doctrine:query:sql \"\ - copy actor from '/tmp/backup/actor.csv'; copy local_user from '/tmp/backup/local_user.csv';\ - copy activitypub_actor from '/tmp/backup/ap_actor.csv'; copy activitypub_rsa from '/tmp/backup/ap_rsa.csv';\ - copy actor_subscription from '/tmp/backup/actor_subscription.csv'; copy local_group from '/tmp/backup/local_group.csv';\ + copy actor from '/tmp/backup/actor.csv';\ + copy local_user from '/tmp/backup/local_user.csv';\ + copy local_group from '/tmp/backup/local_group.csv';\ + \ + copy activitypub_actor from '/tmp/backup/ap_actor.csv';\ + copy activitypub_rsa from '/tmp/backup/ap_rsa.csv';\ + \ + copy actor_subscription from '/tmp/backup/actor_subscription.csv';\ + copy group_member from '/tmp/backup/group_member.csv';\ + \ copy feed from '/tmp/backup/feed.csv';\ `cat /tmp/social-sql-backup/sequences`\"" diff --git a/components/Group/Entity/GroupMember.php b/components/Group/Entity/GroupMember.php index ef92c44ab1..cb646a6350 100644 --- a/components/Group/Entity/GroupMember.php +++ b/components/Group/Entity/GroupMember.php @@ -45,8 +45,7 @@ class GroupMember extends Entity // @codeCoverageIgnoreStart private int $group_id; private int $actor_id; - private int $roles = ActorLocalRoles::VISITOR; - private ?string $uri = null; + private int $roles = ActorLocalRoles::VISITOR; private DateTimeInterface $created; private DateTimeInterface $modified; @@ -83,17 +82,6 @@ class GroupMember extends Entity return $this->roles; } - public function setUri(?string $uri): self - { - $this->uri = \is_null($uri) ? null : mb_substr($uri, 0, 191); - return $this; - } - - public function getUri(): ?string - { - return $this->uri; - } - public function setCreated(DateTimeInterface $created): self { $this->created = $created; @@ -127,15 +115,11 @@ class GroupMember extends Entity 'group_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'name' => 'group_member_group_id_fkey', 'not null' => true, 'description' => 'foreign key to group table'], 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'name' => 'group_member_actor_id_fkey', 'not null' => true, 'description' => 'foreign key to actor table'], 'roles' => ['type' => 'int', 'not null' => true, 'default' => ActorLocalRoles::VISITOR, 'description' => 'Bitmap of permissions this actor has'], - 'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'], 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], ], 'primary key' => ['group_id', 'actor_id'], - 'unique keys' => [ - 'group_member_uri_key' => ['uri'], - ], - 'indexes' => [ + 'indexes' => [ 'group_member_actor_id_idx' => ['actor_id'], 'group_member_created_idx' => ['created'], 'group_member_actor_id_created_idx' => ['actor_id', 'created'],