mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-30 17:47:55 +00:00 
			
		
		
		
	Revert "Make current migrations work with postgresql"
This reverts commit 9b9f3731f6.
			
			
This commit is contained in:
		| @@ -8,9 +8,8 @@ RUN mkdir -p /app | ||||
| WORKDIR /app | ||||
|  | ||||
| COPY requirements-prod.txt requirements.txt | ||||
| RUN apk add --no-cache libressl curl postgresql-client \ | ||||
|  && apk add --no-cache --virtual build-dep \ | ||||
|  libressl-dev libffi-dev python3-dev build-base postgresql-dev \ | ||||
| RUN apk add --no-cache openssl curl \ | ||||
|  && apk add --no-cache --virtual build-dep openssl-dev libffi-dev python3-dev build-base \ | ||||
|  && pip3 install -r requirements.txt \ | ||||
|  && apk del --no-cache build-dep | ||||
|  | ||||
|   | ||||
| @@ -80,17 +80,14 @@ class ConfigManager(dict): | ||||
|             key: os.environ.get(key, value) | ||||
|             for key, value in DEFAULT_CONFIG.items() | ||||
|         }) | ||||
|         if self.config['SQL_FLAVOR'] != 'sqlite' | ||||
|             self.setsql() | ||||
|         app.config = self | ||||
|  | ||||
|     def setsql(self): | ||||
|         if not self.config['DB_PW']: | ||||
|     def setsql(self) | ||||
|         if not self.config['DB_PW'] | ||||
|             self.config['DB_PW'] = self.config['SECRET_KEY'] | ||||
|         self.config['SQLALCHEMY_DATABASE_URI'] = '{driver}://{user}:{pw}@{url}/{db}'.format( | ||||
|             driver=self.config['DB_FLAVOR'], | ||||
|             user=self.config['DB_USER'], | ||||
|             pw=self.config['DB_PW'], | ||||
|             url=self.config['DB_URL'], | ||||
|             db=self.config['DB_NAME'] | ||||
|         ) | ||||
|         self.config['SQLALCHEMY_DATABASE_URI'] = '{driver}://{user}:{pw}@{url}/{db}'.format(driver=DB_FLAVOR,user=DB_USER,pw=DB_PW,url=DB_URL,db=DB_NAME) | ||||
|  | ||||
|     def setdefault(self, key, value): | ||||
|         if key not in self.config: | ||||
|   | ||||
| @@ -309,7 +309,7 @@ class User(Base, Email): | ||||
|     # Settings | ||||
|     displayed_name = db.Column(db.String(160), nullable=False, default="") | ||||
|     spam_enabled = db.Column(db.Boolean(), nullable=False, default=True) | ||||
|     spam_threshold = db.Column(db.Integer(), nullable=False, default=80) | ||||
|     spam_threshold = db.Column(db.Integer(), nullable=False, default=80.0) | ||||
|  | ||||
|     # Flask-login attributes | ||||
|     is_authenticated = True | ||||
| @@ -463,7 +463,7 @@ class Fetch(Base): | ||||
|         nullable=False) | ||||
|     user = db.relationship(User, | ||||
|         backref=db.backref('fetches', cascade='all, delete-orphan')) | ||||
|     protocol = db.Column(db.Enum('imap', 'pop3', name='protocol'), nullable=False) | ||||
|     protocol = db.Column(db.Enum('imap', 'pop3'), nullable=False) | ||||
|     host = db.Column(db.String(255), nullable=False) | ||||
|     port = db.Column(db.Integer(), nullable=False) | ||||
|     tls = db.Column(db.Boolean(), nullable=False) | ||||
|   | ||||
| @@ -12,11 +12,9 @@ down_revision = '49d77a93118e' | ||||
|  | ||||
| from alembic import op | ||||
| import sqlalchemy as sa | ||||
| from flask import current_app as app | ||||
|  | ||||
|  | ||||
| def upgrade(): | ||||
|     if app.config['DB_FLAVOR'] == 'sqlite': | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE")) | ||||
|  | ||||
|   | ||||
| @@ -35,7 +35,7 @@ def upgrade(): | ||||
|          ) | ||||
|     # set default to 80% | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('spam_threshold', server_default='80') | ||||
|         batch.alter_column('spam_threshold', default=80.) | ||||
|  | ||||
| def downgrade(): | ||||
|     connection = op.get_bind() | ||||
| @@ -50,4 +50,4 @@ def downgrade(): | ||||
|          ) | ||||
|     # set default to 10/15 | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('spam_threshold', server_default='10') | ||||
|         batch.alter_column('spam_threshold', default=10.) | ||||
|   | ||||
| @@ -12,11 +12,9 @@ down_revision = 'c162ac88012a' | ||||
|  | ||||
| from alembic import op | ||||
| import sqlalchemy as sa | ||||
| from flask import current_app as app | ||||
|  | ||||
|  | ||||
| def upgrade(): | ||||
|     if app.config['DB_FLAVOR'] == 'sqlite': | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE")) | ||||
|     with op.batch_alter_table('alias') as batch: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kaiyou
					kaiyou