-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path26b7c9ffcb2b_store_human_readable_languages.py
158 lines (149 loc) · 6.85 KB
/
26b7c9ffcb2b_store_human_readable_languages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
"""store human readable languages
Revision ID: 26b7c9ffcb2b
Revises: 6bcd31d976d6
Create Date: 2022-01-05 02:33:06.736091
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = "26b7c9ffcb2b"
down_revision = "6bcd31d976d6"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("languages")
languages_table = op.create_table(
"languages",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("language", mysql.TEXT(), nullable=False),
sa.Column("is_rtl", sa.Boolean(), nullable=True, default=False),
sa.PrimaryKeyConstraint("id"),
)
op.bulk_insert(
languages_table,
[
{"language": "Arabic", "is_rtl": True},
{"language": "Asante Twi", "is_rtl": False},
{"language": "Assamese", "is_rtl": False},
{"language": "Bengali", "is_rtl": False},
{"language": "Bhili", "is_rtl": False},
{"language": "Catalan", "is_rtl": False},
{"language": "Chatino", "is_rtl": False},
{"language": "Danish", "is_rtl": False},
{"language": "Dutch", "is_rtl": False},
{"language": "English (UK)", "is_rtl": False},
{"language": "English (US)", "is_rtl": False},
{"language": "English (Indian)", "is_rtl": False},
{"language": "Esperanto", "is_rtl": False},
{"language": "French", "is_rtl": False},
{"language": "Georgian", "is_rtl": False},
{"language": "German", "is_rtl": False},
{"language": "Greek", "is_rtl": False},
{"language": "Gujarati", "is_rtl": False},
{"language": "Hebrew", "is_rtl": True},
{"language": "Hindi", "is_rtl": False},
{"language": "Indonesian", "is_rtl": False},
{"language": "Italian", "is_rtl": False},
{"language": "Japanese", "is_rtl": False},
{"language": "Kannada", "is_rtl": False},
{"language": "Kazakh", "is_rtl": False},
{"language": "Khmer", "is_rtl": False},
{"language": "Kotava", "is_rtl": False},
{"language": "Kurdish", "is_rtl": True},
{"language": "Kutchi", "is_rtl": False},
{"language": "Lidepla", "is_rtl": False},
{"language": "Malayalam", "is_rtl": False},
{"language": "Maltese", "is_rtl": False},
{"language": "Mandarin", "is_rtl": False},
{"language": "Marathi", "is_rtl": False},
{"language": "Nepali", "is_rtl": False},
{"language": "Norwegian", "is_rtl": False},
{"language": "Oriya", "is_rtl": False},
{"language": "Polish", "is_rtl": False},
{"language": "Portuguese", "is_rtl": False},
{"language": "Punjabi", "is_rtl": False},
{"language": "Romanian", "is_rtl": False},
{"language": "Russian", "is_rtl": False},
{"language": "Sanskrit", "is_rtl": False},
{"language": "Santali", "is_rtl": False},
{"language": "Spanish", "is_rtl": False},
{"language": "Swahili", "is_rtl": False},
{"language": "Tamang", "is_rtl": False},
{"language": "Tamil", "is_rtl": False},
{"language": "Telugu", "is_rtl": False},
{"language": "Turkish", "is_rtl": False},
{"language": "Ukrainian", "is_rtl": False},
{"language": "Urdu", "is_rtl": True},
],
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("languages")
languages_table = op.create_table(
"languages",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("language", mysql.TEXT(), nullable=False),
sa.Column("is_rtl", sa.Boolean(), nullable=True, default=False),
sa.PrimaryKeyConstraint("id"),
)
op.bulk_insert(
languages_table,
[
{"language": "ARABIC", "is_rtl": True},
{"language": "ASANTE TWI", "is_rtl": False},
{"language": "ASSAMESE", "is_rtl": False},
{"language": "BENGALI", "is_rtl": False},
{"language": "BHILI", "is_rtl": False},
{"language": "CATALAN", "is_rtl": False},
{"language": "CHATINO", "is_rtl": False},
{"language": "DANISH", "is_rtl": False},
{"language": "DUTCH", "is_rtl": False},
{"language": "ENGLISH_UK", "is_rtl": False},
{"language": "ENGLISH_US", "is_rtl": False},
{"language": "ENGLISH_INDIAN", "is_rtl": False},
{"language": "ESPERANTO", "is_rtl": False},
{"language": "FRENCH", "is_rtl": False},
{"language": "GEORGIAN", "is_rtl": False},
{"language": "GERMAN", "is_rtl": False},
{"language": "GREEK", "is_rtl": False},
{"language": "GUJARATI", "is_rtl": False},
{"language": "HEBREW", "is_rtl": True},
{"language": "HINDI", "is_rtl": False},
{"language": "INDONESIAN", "is_rtl": False},
{"language": "ITALIAN", "is_rtl": False},
{"language": "JAPANESE", "is_rtl": False},
{"language": "KANNADA", "is_rtl": False},
{"language": "KAZAKH", "is_rtl": False},
{"language": "KHMER", "is_rtl": False},
{"language": "KOTAVA", "is_rtl": False},
{"language": "KURDISH", "is_rtl": True},
{"language": "KUTCHI", "is_rtl": False},
{"language": "LIDEPLA", "is_rtl": False},
{"language": "MALAYALAM", "is_rtl": False},
{"language": "MALTESE", "is_rtl": False},
{"language": "MANDARIN", "is_rtl": False},
{"language": "MARATHI", "is_rtl": False},
{"language": "NEPALI", "is_rtl": False},
{"language": "NORWEGIAN", "is_rtl": False},
{"language": "ORIYA", "is_rtl": False},
{"language": "POLISH", "is_rtl": False},
{"language": "PORTUGUESE", "is_rtl": False},
{"language": "PUNJABI", "is_rtl": False},
{"language": "ROMANIAN", "is_rtl": False},
{"language": "RUSSIAN", "is_rtl": False},
{"language": "SANSKRIT", "is_rtl": False},
{"language": "SANTALI", "is_rtl": False},
{"language": "SPANISH", "is_rtl": False},
{"language": "SWAHILI", "is_rtl": False},
{"language": "TAMANG", "is_rtl": False},
{"language": "TAMIL", "is_rtl": False},
{"language": "TELUGU", "is_rtl": False},
{"language": "TURKISH", "is_rtl": False},
{"language": "UKRAINIAN", "is_rtl": False},
{"language": "URDU", "is_rtl": True},
],
)
# ### end Alembic commands ###