Skip to content

Commit

Permalink
feat: remplacer un nom de domaine expiré dans les données utilisateurs (
Browse files Browse the repository at this point in the history
#907)

## Description

🎸 Migrations pour remplacer en masse le nom de domaine dans les emails
de `User`, `EmailLastSeen` et `Post` (cas des messages anonymes)

## Type de changement

🚧 technique
  • Loading branch information
vincentporte authored Feb 12, 2025
1 parent 95bea05 commit fb886e1
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lacommunaute/forum_conversation/migrations/0009_run_management.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.1.5 on 2025-02-11 14:41

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("forum_conversation", "0008_remove_topic_likers"),
]

operations = [
migrations.RunSQL(
"""
UPDATE forum_conversation_post
SET username = LOWER(username);
""",
elidable=True,
),
migrations.RunSQL(
"""
UPDATE forum_conversation_post
SET username = regexp_replace(username, '@pole-emploi.fr$', '@francetravail.fr')
WHERE username LIKE '%@pole-emploi.fr';
""",
elidable=True,
),
]
27 changes: 27 additions & 0 deletions lacommunaute/users/migrations/0008_run_management.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.1.5 on 2025-02-11 14:37

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("users", "0007_alter_emaillastseen_last_seen_kind"),
]

operations = [
migrations.RunSQL(
"""
UPDATE users_user
SET email = regexp_replace(email, '@pole-emploi.fr$', '@francetravail.fr')
WHERE email LIKE '%@pole-emploi.fr';
"""
),
migrations.RunSQL(
"""
UPDATE users_emaillastseen
SET email = regexp_replace(email, '@pole-emploi.fr$', '@francetravail.fr')
WHERE email LIKE '%@pole-emploi.fr';
""",
elidable=True,
),
]

0 comments on commit fb886e1

Please sign in to comment.