-
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 (#132)
closes [#131 ](#131) --------- Co-authored-by: Nargis Sultani <[email protected]>
- Loading branch information
1 parent
3d846b2
commit 91f1fcc
Showing
3 changed files
with
370 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": "126.com"}, | ||
{"domain": "163.com"}, | ||
{"domain": "21cn.com"}, | ||
{"domain": "alice.it"}, | ||
{"domain": "aliyun.com"}, | ||
{"domain": "aol.com"}, | ||
{"domain": "aol.it"}, | ||
{"domain": "arnet.com.ar"}, | ||
{"domain": "att.net"}, | ||
{"domain": "bell.net"}, | ||
{"domain": "bellsouth.net"}, | ||
{"domain": "blueyonder.co.uk"}, | ||
{"domain": "bol.com.br"}, | ||
{"domain": "bt.com"}, | ||
{"domain": "btinternet.com"}, | ||
{"domain": "charter.net"}, | ||
{"domain": "comcast.net"}, | ||
{"domain": "cox.net"}, | ||
{"domain": "daum.net"}, | ||
{"domain": "earthlink.net"}, | ||
{"domain": "email.com"}, | ||
{"domain": "email.it"}, | ||
{"domain": "facebook.com"}, | ||
{"domain": "fastmail.fm"}, | ||
{"domain": "fibertel.com.ar"}, | ||
{"domain": "foxmail.com"}, | ||
{"domain": "free.fr"}, | ||
{"domain": "freeserve.co.uk"}, | ||
{"domain": "games.com"}, | ||
{"domain": "globo.com"}, | ||
{"domain": "globomail.com"}, | ||
{"domain": "gmail.com"}, | ||
{"domain": "gmx.com"}, | ||
{"domain": "gmx.de"}, | ||
{"domain": "gmx.fr"}, | ||
{"domain": "gmx.net"}, | ||
{"domain": "google.com"}, | ||
{"domain": "googlemail.com"}, | ||
{"domain": "hanmail.net"}, | ||
{"domain": "hotmail.be"}, | ||
{"domain": "hotmail.ca"}, | ||
{"domain": "hotmail.co.uk"}, | ||
{"domain": "hotmail.com.ar"}, | ||
{"domain": "hotmail.com.br"}, | ||
{"domain": "hotmail.com.mx"}, | ||
{"domain": "hotmail.com"}, | ||
{"domain": "hotmail.de"}, | ||
{"domain": "hotmail.es"}, | ||
{"domain": "hotmail.fr"}, | ||
{"domain": "hotmail.it"}, | ||
{"domain": "hush.com"}, | ||
{"domain": "hushmail.com"}, | ||
{"domain": "icloud.com"}, | ||
{"domain": "ig.com.br"}, | ||
{"domain": "iname.com"}, | ||
{"domain": "inbox.com"}, | ||
{"domain": "itelefonica.com.br"}, | ||
{"domain": "juno.com"}, | ||
{"domain": "keemail.me"}, | ||
{"domain": "laposte.net"}, | ||
{"domain": "lavabit.com"}, | ||
{"domain": "libero.it"}, | ||
{"domain": "list.ru"}, | ||
{"domain": "live.be"}, | ||
{"domain": "live.co.uk"}, | ||
{"domain": "live.com.ar"}, | ||
{"domain": "live.com.mx"}, | ||
{"domain": "live.com"}, | ||
{"domain": "live.de"}, | ||
{"domain": "live.fr"}, | ||
{"domain": "live.it"}, | ||
{"domain": "love.com"}, | ||
{"domain": "mac.com"}, | ||
{"domain": "mail.com"}, | ||
{"domain": "mail.ru"}, | ||
{"domain": "me.com"}, | ||
{"domain": "msn.com"}, | ||
{"domain": "nate.com"}, | ||
{"domain": "naver.com"}, | ||
{"domain": "neuf.fr"}, | ||
{"domain": "ntlworld.com"}, | ||
{"domain": "o2.co.uk"}, | ||
{"domain": "oi.com.br"}, | ||
{"domain": "online.de"}, | ||
{"domain": "orange.fr"}, | ||
{"domain": "orange.net"}, | ||
{"domain": "outlook.com.br"}, | ||
{"domain": "outlook.com"}, | ||
{"domain": "pobox.com"}, | ||
{"domain": "poste.it"}, | ||
{"domain": "prodigy.net.mx"}, | ||
{"domain": "protonmail.ch"}, | ||
{"domain": "protonmail.com"}, | ||
{"domain": "qq.com"}, | ||
{"domain": "r7.com"}, | ||
{"domain": "rambler.ru"}, | ||
{"domain": "rocketmail.com"}, | ||
{"domain": "rogers.com"}, | ||
{"domain": "safe-mail.net"}, | ||
{"domain": "sbcglobal.net"}, | ||
{"domain": "sfr.fr"}, | ||
{"domain": "shaw.ca"}, | ||
{"domain": "sina.cn"}, | ||
{"domain": "sina.com"}, | ||
{"domain": "sky.com"}, | ||
{"domain": "skynet.be"}, | ||
{"domain": "speedy.com.ar"}, | ||
{"domain": "sympatico.ca"}, | ||
{"domain": "t-online.de"}, | ||
{"domain": "talktalk.co.uk"}, | ||
{"domain": "telenet.be"}, | ||
{"domain": "teletu.it"}, | ||
{"domain": "terra.com.br"}, | ||
{"domain": "tin.it"}, | ||
{"domain": "tiscali.co.uk"}, | ||
{"domain": "tiscali.it"}, | ||
{"domain": "tuta.io"}, | ||
{"domain": "tutamail.com"}, | ||
{"domain": "tutanota.com"}, | ||
{"domain": "tutanota.de"}, | ||
{"domain": "tvcablenet.be"}, | ||
{"domain": "uol.com.br"}, | ||
{"domain": "verizon.net"}, | ||
{"domain": "virgilio.it"}, | ||
{"domain": "virgin.net"}, | ||
{"domain": "virginmedia.com"}, | ||
{"domain": "voo.be"}, | ||
{"domain": "wanadoo.co.uk"}, | ||
{"domain": "wanadoo.fr"}, | ||
{"domain": "web.de"}, | ||
{"domain": "wow.com,ygm.com"}, | ||
{"domain": "ya.ru"}, | ||
{"domain": "yahoo.ca"}, | ||
{"domain": "yahoo.co.id"}, | ||
{"domain": "yahoo.co.in"}, | ||
{"domain": "yahoo.co.jp"}, | ||
{"domain": "yahoo.co.kr"}, | ||
{"domain": "yahoo.co.uk"}, | ||
{"domain": "yahoo.com.ar"}, | ||
{"domain": "yahoo.com.br"}, | ||
{"domain": "yahoo.com.mx"}, | ||
{"domain": "yahoo.com.ph"}, | ||
{"domain": "yahoo.com.sg"}, | ||
{"domain": "yahoo.com"}, | ||
{"domain": "yahoo.de"}, | ||
{"domain": "yahoo.fr"}, | ||
{"domain": "yahoo.it"}, | ||
{"domain": "yandex.com"}, | ||
{"domain": "yandex.ru"}, | ||
{"domain": "yeah.net"}, | ||
{"domain": "ymail.com"}, | ||
{"domain": "zipmail.com.br"}, | ||
{"domain": "zoho.com"}, | ||
] | ||
|
||
|
||
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.
Oops, something went wrong.