-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket 131: seed denied domains table
- Loading branch information
Nargis Sultani
committed
Mar 22, 2024
1 parent
3d846b2
commit d3777c2
Showing
3 changed files
with
217 additions
and
7 deletions.
There are no files selected for viewing
189 changes: 189 additions & 0 deletions
189
db_revisions/versions/d6e4a13fbebd_seed_denied_domains_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
"""seed denied domains table | ||
Revision ID: d6e4a13fbebd | ||
Revises: 0e520c01fb42 | ||
Create Date: 2024-03-22 02:13:50.455432 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
from db_revisions.utils import get_indices_from_collection, get_table_by_name | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "d6e4a13fbebd" | ||
down_revision: Union[str, None] = "0e520c01fb42" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
seed_data = [ | ||
{"domain": "aol.com"}, | ||
{"domain": "att.net"}, | ||
{"domain": "comcast.net"}, | ||
{"domain": "facebook.com"}, | ||
{"domain": "gmail.com"}, | ||
{"domain": "gmx.com"}, | ||
{"domain": "googlemail.com"}, | ||
{"domain": "google.com"}, | ||
{"domain": "hotmail.com"}, | ||
{"domain": "hotmail.co.uk"}, | ||
{"domain": "mac.com"}, | ||
{"domain": "me.com"}, | ||
{"domain": "mail.com"}, | ||
{"domain": "msn.com"}, | ||
{"domain": "live.com"}, | ||
{"domain": "sbcglobal.net"}, | ||
{"domain": "verizon.net"}, | ||
{"domain": "yahoo.com"}, | ||
{"domain": "yahoo.co.uk"}, | ||
{"domain": "email.com"}, | ||
{"domain": "fastmail.fm"}, | ||
{"domain": "games.com"}, | ||
{"domain": "gmx.net"}, | ||
{"domain": "hush.com"}, | ||
{"domain": "hushmail.com"}, | ||
{"domain": "icloud.com"}, | ||
{"domain": "iname.com"}, | ||
{"domain": "inbox.com"}, | ||
{"domain": "lavabit.com"}, | ||
{"domain": "love.com"}, | ||
{"domain": "outlook.com"}, | ||
{"domain": "pobox.com"}, | ||
{"domain": "protonmail.ch"}, | ||
{"domain": "protonmail.com"}, | ||
{"domain": "tutanota.de"}, | ||
{"domain": "tutanota.com"}, | ||
{"domain": "tutamail.com"}, | ||
{"domain": "tuta.io"}, | ||
{"domain": "keemail.me"}, | ||
{"domain": "rocketmail.com"}, | ||
{"domain": "safe-mail.net"}, | ||
{"domain": "wow.com,ygm.com"}, | ||
{"domain": "ymail.com"}, | ||
{"domain": "zoho.com"}, | ||
{"domain": "yandex.com"}, | ||
{"domain": "bellsouth.net"}, | ||
{"domain": "charter.net"}, | ||
{"domain": "cox.net"}, | ||
{"domain": "earthlink.net"}, | ||
{"domain": "juno.com"}, | ||
{"domain": "btinternet.com"}, | ||
{"domain": "virginmedia.com"}, | ||
{"domain": "blueyonder.co.uk"}, | ||
{"domain": "freeserve.co.uk"}, | ||
{"domain": "live.co.uk"}, | ||
{"domain": "ntlworld.com"}, | ||
{"domain": "o2.co.uk"}, | ||
{"domain": "orange.net"}, | ||
{"domain": "sky.com"}, | ||
{"domain": "talktalk.co.uk"}, | ||
{"domain": "tiscali.co.uk"}, | ||
{"domain": "virgin.net"}, | ||
{"domain": "wanadoo.co.uk"}, | ||
{"domain": "bt.com"}, | ||
{"domain": "sina.com"}, | ||
{"domain": "sina.cn"}, | ||
{"domain": "qq.com"}, | ||
{"domain": "naver.com"}, | ||
{"domain": "hanmail.net"}, | ||
{"domain": "daum.net"}, | ||
{"domain": "nate.com"}, | ||
{"domain": "yahoo.co.jp"}, | ||
{"domain": "yahoo.co.kr"}, | ||
{"domain": "yahoo.co.id"}, | ||
{"domain": "yahoo.co.in"}, | ||
{"domain": "yahoo.com.sg"}, | ||
{"domain": "yahoo.com.ph"}, | ||
{"domain": "163.com"}, | ||
{"domain": "yeah.net"}, | ||
{"domain": "126.com"}, | ||
{"domain": "21cn.com"}, | ||
{"domain": "aliyun.com"}, | ||
{"domain": "foxmail.com"}, | ||
{"domain": "hotmail.fr"}, | ||
{"domain": "live.fr"}, | ||
{"domain": "laposte.net"}, | ||
{"domain": "yahoo.fr"}, | ||
{"domain": "wanadoo.fr"}, | ||
{"domain": "orange.fr"}, | ||
{"domain": "gmx.fr"}, | ||
{"domain": "sfr.fr"}, | ||
{"domain": "neuf.fr"}, | ||
{"domain": "free.fr"}, | ||
{"domain": "gmx.de"}, | ||
{"domain": "hotmail.de"}, | ||
{"domain": "live.de"}, | ||
{"domain": "online.de"}, | ||
{"domain": "t-online.de"}, | ||
{"domain": "web.de"}, | ||
{"domain": "yahoo.de"}, | ||
{"domain": "libero.it"}, | ||
{"domain": "virgilio.it"}, | ||
{"domain": "hotmail.it"}, | ||
{"domain": "aol.it"}, | ||
{"domain": "tiscali.it"}, | ||
{"domain": "alice.it"}, | ||
{"domain": "live.it"}, | ||
{"domain": "yahoo.it"}, | ||
{"domain": "email.it"}, | ||
{"domain": "tin.it"}, | ||
{"domain": "poste.it"}, | ||
{"domain": "teletu.it"}, | ||
{"domain": "mail.ru"}, | ||
{"domain": "rambler.ru"}, | ||
{"domain": "yandex.ru"}, | ||
{"domain": "ya.ru"}, | ||
{"domain": "list.ru"}, | ||
{"domain": "hotmail.be"}, | ||
{"domain": "live.be"}, | ||
{"domain": "skynet.be"}, | ||
{"domain": "voo.be"}, | ||
{"domain": "tvcablenet.be"}, | ||
{"domain": "telenet.be"}, | ||
{"domain": "hotmail.com.ar"}, | ||
{"domain": "live.com.ar"}, | ||
{"domain": "yahoo.com.ar"}, | ||
{"domain": "fibertel.com.ar"}, | ||
{"domain": "speedy.com.ar"}, | ||
{"domain": "arnet.com.ar"}, | ||
{"domain": "yahoo.com.mx"}, | ||
{"domain": "live.com.mx"}, | ||
{"domain": "hotmail.es"}, | ||
{"domain": "hotmail.com.mx"}, | ||
{"domain": "prodigy.net.mx"}, | ||
{"domain": "yahoo.ca"}, | ||
{"domain": "hotmail.ca"}, | ||
{"domain": "bell.net"}, | ||
{"domain": "shaw.ca"}, | ||
{"domain": "sympatico.ca"}, | ||
{"domain": "rogers.com"}, | ||
{"domain": "yahoo.com.br"}, | ||
{"domain": "hotmail.com.br"}, | ||
{"domain": "outlook.com.br"}, | ||
{"domain": "uol.com.br"}, | ||
{"domain": "bol.com.br"}, | ||
{"domain": "terra.com.br"}, | ||
{"domain": "ig.com.br"}, | ||
{"domain": "itelefonica.com.br"}, | ||
{"domain": "r7.com"}, | ||
{"domain": "zipmail.com.br"}, | ||
{"domain": "globo.com"}, | ||
{"domain": "globomail.com"}, | ||
{"domain": "oi.com.br"}, | ||
] | ||
|
||
|
||
def upgrade() -> None: | ||
table = get_table_by_name("denied_domains") | ||
|
||
op.bulk_insert(table, seed_data) | ||
|
||
|
||
def downgrade() -> None: | ||
table = get_table_by_name("denied_domains") | ||
|
||
domains = get_indices_from_collection(seed_data, "domain") | ||
|
||
op.execute(table.delete().where(table.c.domain.in_(domains))) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters