Browse Source

[COMPONENT][Group][Entity] Useless URI column removed

Add table to Makefile backup
experimental
parent
commit
ff06a2656a
Signed by: diogo <mail@diogo.site> GPG Key ID: 18D2D35001FBFAB0
2 changed files with 22 additions and 24 deletions
  1. +20
    -6
      Makefile
  2. +2
    -18
      components/Group/Entity/GroupMember.php

+ 20
- 6
Makefile View File

@@ -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`\""



+ 2
- 18
components/Group/Entity/GroupMember.php View File

@@ -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'],


Loading…
Cancel
Save