Browse Source

add is_deleted for user in db

Guénaël Muller 6 years ago
parent
commit
3e8a557ae1
3 changed files with 10 additions and 0 deletions
  1. 4 0
      backend/README.md
  2. 4 0
      backend/doc/migration.md
  3. 2 0
      backend/tracim_backend/models/auth.py

+ 4 - 0
backend/README.md View File

77
 
77
 
78
     tracimcli db init
78
     tracimcli db init
79
 
79
 
80
+Stamp current version of database to last (useful for migration):
81
+
82
+    alembic -c development.ini stamp head
83
+
80
 create wsgidav configuration file for webdav:
84
 create wsgidav configuration file for webdav:
81
 
85
 
82
     cp wsgidav.conf.sample wsgidav.conf
86
     cp wsgidav.conf.sample wsgidav.conf

+ 4 - 0
backend/doc/migration.md View File

28
 
28
 
29
     alembic -c development.ini current
29
     alembic -c development.ini current
30
 
30
 
31
+## Set Alembic stamp to last version (first time use) ##
32
+
33
+    alembic -c development.ini stamp head
34
+
31
 ### Creating new schema migration ###
35
 ### Creating new schema migration ###
32
 
36
 
33
 This creates a new auto-generated python migration file 
37
 This creates a new auto-generated python migration file 

+ 2 - 0
backend/tracim_backend/models/auth.py View File

15
 from hashlib import sha256
15
 from hashlib import sha256
16
 from typing import TYPE_CHECKING
16
 from typing import TYPE_CHECKING
17
 
17
 
18
+import sqlalchemy
18
 from sqlalchemy import Column
19
 from sqlalchemy import Column
19
 from sqlalchemy import ForeignKey
20
 from sqlalchemy import ForeignKey
20
 from sqlalchemy import Sequence
21
 from sqlalchemy import Sequence
135
     _password = Column('password', Unicode(128))
136
     _password = Column('password', Unicode(128))
136
     created = Column(DateTime, default=datetime.utcnow)
137
     created = Column(DateTime, default=datetime.utcnow)
137
     is_active = Column(Boolean, default=True, nullable=False)
138
     is_active = Column(Boolean, default=True, nullable=False)
139
+    is_deleted = Column(Boolean, default=False, nullable=False, server_default=sqlalchemy.sql.expression.literal(False))
138
     imported_from = Column(Unicode(32), nullable=True)
140
     imported_from = Column(Unicode(32), nullable=True)
139
     timezone = Column(Unicode(255), nullable=False, server_default='')
141
     timezone = Column(Unicode(255), nullable=False, server_default='')
140
     # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed
142
     # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed