mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-09 17:13:45 +01:00
Add created_at to User and UserEmailVerification
This commit is contained in:
parent
dd352faa31
commit
3b5c9950de
@ -124,6 +124,8 @@ def display_name_default(context):
|
|||||||
class User(db.Model, UserMixin):
|
class User(db.Model, UserMixin):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|
||||||
|
created_at = db.Column(db.DateTime, nullable=True, default=datetime.datetime.utcnow)
|
||||||
|
|
||||||
# User authentication information
|
# User authentication information
|
||||||
username = db.Column(db.String(50, collation="NOCASE"), nullable=False, unique=True, index=True)
|
username = db.Column(db.String(50, collation="NOCASE"), nullable=False, unique=True, index=True)
|
||||||
password = db.Column(db.String(255), nullable=True, server_default=None)
|
password = db.Column(db.String(255), nullable=True, server_default=None)
|
||||||
@ -288,6 +290,7 @@ class UserEmailVerification(db.Model):
|
|||||||
token = db.Column(db.String(32), nullable=True)
|
token = db.Column(db.String(32), nullable=True)
|
||||||
user = db.relationship("User", foreign_keys=[user_id], back_populates="email_verifications")
|
user = db.relationship("User", foreign_keys=[user_id], back_populates="email_verifications")
|
||||||
is_password_reset = db.Column(db.Boolean, nullable=False, default=False)
|
is_password_reset = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
|
created_at = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow)
|
||||||
|
|
||||||
|
|
||||||
class EmailSubscription(db.Model):
|
class EmailSubscription(db.Model):
|
||||||
|
28
migrations/versions/96a01fe23389_.py
Normal file
28
migrations/versions/96a01fe23389_.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 96a01fe23389
|
||||||
|
Revises: cd5ab8a01f4a
|
||||||
|
Create Date: 2021-11-24 17:12:33.893988
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '96a01fe23389'
|
||||||
|
down_revision = 'cd5ab8a01f4a'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.execute("DELETE FROM user_email_verification")
|
||||||
|
op.add_column('user', sa.Column('created_at', sa.DateTime(), nullable=True))
|
||||||
|
op.add_column('user_email_verification', sa.Column('created_at', sa.DateTime(), nullable=False))
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
|
||||||
|
op.drop_column('user_email_verification', 'created_at')
|
||||||
|
op.drop_column('user', 'created_at')
|
Loading…
Reference in New Issue
Block a user