Add user.default_mailbox_id col
This commit is contained in:
parent
0a5113962f
commit
9669c04414
|
@ -145,6 +145,11 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||||
db.Boolean, default=False, nullable=False, server_default="0"
|
db.Boolean, default=False, nullable=False, server_default="0"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# the mailbox used when create random alias
|
||||||
|
default_mailbox_id = db.Column(
|
||||||
|
db.ForeignKey("mailbox.id"), nullable=True, default=None
|
||||||
|
)
|
||||||
|
|
||||||
profile_picture = db.relationship(File)
|
profile_picture = db.relationship(File)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -165,9 +170,10 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||||
# todo: uncomment when all existing users are full_mailbox
|
# todo: uncomment when all existing users are full_mailbox
|
||||||
# to run just after migrating all existing user to full mailbox
|
# to run just after migrating all existing user to full mailbox
|
||||||
# so new users are automatically full-mailbox
|
# so new users are automatically full-mailbox
|
||||||
# Mailbox.create(user_id=user.id, email=user.email, verified=True)
|
# mb = Mailbox.create(user_id=user.id, email=user.email, verified=True)
|
||||||
# user.full_mailbox = True
|
|
||||||
# db.session.flush()
|
# db.session.flush()
|
||||||
|
# user.full_mailbox = True
|
||||||
|
# user.default_mailbox_id = mb.id
|
||||||
|
|
||||||
# Schedule onboarding emails
|
# Schedule onboarding emails
|
||||||
Job.create(
|
Job.create(
|
||||||
|
@ -860,8 +866,6 @@ class Mailbox(db.Model, ModelMixin):
|
||||||
# used when user wants to update mailbox email
|
# used when user wants to update mailbox email
|
||||||
new_email = db.Column(db.String(256), unique=True)
|
new_email = db.Column(db.String(256), unique=True)
|
||||||
|
|
||||||
user = db.relationship(User)
|
|
||||||
|
|
||||||
def nb_alias(self):
|
def nb_alias(self):
|
||||||
return GenEmail.filter_by(mailbox_id=self.id).count()
|
return GenEmail.filter_by(mailbox_id=self.id).count()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue