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

Add table to Makefile backup
This commit is contained in:
Diogo Peralta Cordeiro 2022-03-07 15:47:52 +00:00
parent d5fd7da707
commit ff06a2656a
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 22 additions and 24 deletions

View File

@ -83,9 +83,16 @@ backup-actors:
sh -c 'su postgres -c "mkdir -p /tmp/backup"' && \ sh -c 'su postgres -c "mkdir -p /tmp/backup"' && \
docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \ docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \
sh -c "cd /var/www/social && bin/console doctrine:query:sql \"\ 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 actor to '/tmp/backup/actor.csv';\
copy activitypub_actor to '/tmp/backup/ap_actor.csv'; copy activitypub_rsa to '/tmp/backup/ap_rsa.csv';\ copy local_user to '/tmp/backup/local_user.csv';\
copy actor_subscription to '/tmp/backup/actor_subscription.csv'; copy local_group to '/tmp/backup/local_group.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 feed to '/tmp/backup/feed.csv';\
copy (SELECT 'ALTER SEQUENCE ' || c.relname || ' RESTART WITH ' || nextval(c.relname::regclass) || ';'\ copy (SELECT 'ALTER SEQUENCE ' || c.relname || ' RESTART WITH ' || nextval(c.relname::regclass) || ';'\
FROM pg_class c WHERE c.relkind = 'S') to '/tmp/backup/sequences';\"" && \ 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))_db_1) sh -c 'chown postgres /tmp/backup' && \
docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \ docker exec -it $(call translate-container-name,$(strip $(DIR))_php_1) \
sh -c "cd /var/www/social && bin/console doctrine:query:sql \"\ 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 actor from '/tmp/backup/actor.csv';\
copy activitypub_actor from '/tmp/backup/ap_actor.csv'; copy activitypub_rsa from '/tmp/backup/ap_rsa.csv';\ copy local_user from '/tmp/backup/local_user.csv';\
copy actor_subscription from '/tmp/backup/actor_subscription.csv'; copy local_group from '/tmp/backup/local_group.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';\ copy feed from '/tmp/backup/feed.csv';\
`cat /tmp/social-sql-backup/sequences`\"" `cat /tmp/social-sql-backup/sequences`\""

View File

@ -45,8 +45,7 @@ class GroupMember extends Entity
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
private int $group_id; private int $group_id;
private int $actor_id; private int $actor_id;
private int $roles = ActorLocalRoles::VISITOR; private int $roles = ActorLocalRoles::VISITOR;
private ?string $uri = null;
private DateTimeInterface $created; private DateTimeInterface $created;
private DateTimeInterface $modified; private DateTimeInterface $modified;
@ -83,17 +82,6 @@ class GroupMember extends Entity
return $this->roles; 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 public function setCreated(DateTimeInterface $created): self
{ {
$this->created = $created; $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'], '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'], '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'], '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'], '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'], 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
], ],
'primary key' => ['group_id', 'actor_id'], 'primary key' => ['group_id', 'actor_id'],
'unique keys' => [ 'indexes' => [
'group_member_uri_key' => ['uri'],
],
'indexes' => [
'group_member_actor_id_idx' => ['actor_id'], 'group_member_actor_id_idx' => ['actor_id'],
'group_member_created_idx' => ['created'], 'group_member_created_idx' => ['created'],
'group_member_actor_id_created_idx' => ['actor_id', 'created'], 'group_member_actor_id_created_idx' => ['actor_id', 'created'],