Pārlūkot izejas kodu

add lang to user table in db

Guénaël Muller 6 gadus atpakaļ
vecāks
revīzija
a597138957

+ 26 - 0
backend/tracim_backend/migration/versions/a143b60aad61_add_lang_to_user.py Parādīt failu

@@ -0,0 +1,26 @@
1
+"""add lang to user
2
+
3
+Revision ID: a143b60aad61
4
+Revises: 78b52ca39419
5
+Create Date: 2018-08-20 10:17:14.859250
6
+
7
+"""
8
+
9
+# revision identifiers, used by Alembic.
10
+revision = 'a143b60aad61'
11
+down_revision = '78b52ca39419'
12
+
13
+from alembic import op
14
+import sqlalchemy as sa
15
+
16
+
17
+def upgrade():
18
+    # ### commands auto generated by Alembic - please adjust! ###
19
+    op.add_column('users', sa.Column('lang', sa.Unicode(length=3), nullable=True))  # nopep8
20
+    # ### end Alembic commands ###
21
+
22
+
23
+def downgrade():
24
+    # ### commands auto generated by Alembic - please adjust! ###
25
+    op.drop_column('users', 'lang')
26
+    # ### end Alembic commands ###

+ 3 - 0
backend/tracim_backend/models/auth.py Parādīt failu

@@ -138,7 +138,10 @@ class User(DeclarativeBase):
138 138
     is_active = Column(Boolean, default=True, nullable=False)
139 139
     is_deleted = Column(Boolean, default=False, nullable=False, server_default=sqlalchemy.sql.expression.literal(False))
140 140
     imported_from = Column(Unicode(32), nullable=True)
141
+    # timezone as tz database format
141 142
     timezone = Column(Unicode(255), nullable=False, server_default='')
143
+    # lang in iso639 format
144
+    lang = Column(Unicode(3), nullable=True, default=None)
142 145
     # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed
143 146
     # with new auth system
144 147
     auth_token = Column(Unicode(255))