浏览代码

add is_deleted for user in db

Guénaël Muller 5 年前
父节点
当前提交
3e8a557ae1
共有 3 个文件被更改,包括 10 次插入0 次删除
  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 查看文件

@@ -77,6 +77,10 @@ Initialize the database using [tracimcli](doc/cli.md) tool
77 77
 
78 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 84
 create wsgidav configuration file for webdav:
81 85
 
82 86
     cp wsgidav.conf.sample wsgidav.conf

+ 4 - 0
backend/doc/migration.md 查看文件

@@ -28,6 +28,10 @@ and active the Tracim virtualenv:
28 28
 
29 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 35
 ### Creating new schema migration ###
32 36
 
33 37
 This creates a new auto-generated python migration file 

+ 2 - 0
backend/tracim_backend/models/auth.py 查看文件

@@ -15,6 +15,7 @@ from datetime import datetime
15 15
 from hashlib import sha256
16 16
 from typing import TYPE_CHECKING
17 17
 
18
+import sqlalchemy
18 19
 from sqlalchemy import Column
19 20
 from sqlalchemy import ForeignKey
20 21
 from sqlalchemy import Sequence
@@ -135,6 +136,7 @@ class User(DeclarativeBase):
135 136
     _password = Column('password', Unicode(128))
136 137
     created = Column(DateTime, default=datetime.utcnow)
137 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 140
     imported_from = Column(Unicode(32), nullable=True)
139 141
     timezone = Column(Unicode(255), nullable=False, server_default='')
140 142
     # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed