Commit d716fe3d authored by contabo-server's avatar contabo-server
Browse files

fix cascading dfelete and remove monitoringdashboard

parent dced6e9a
......@@ -8,7 +8,6 @@ from redis import Redis
from rq import Queue
from dotenv import load_dotenv
from flask_migrate import Migrate
import flask_monitoringdashboard as dashboard
from flask_admin.contrib.sqla import ModelView
load_dotenv()
......@@ -33,10 +32,6 @@ migrate = Migrate(app, db)
admin = Admin(app, name='ChiefSend-Admin')
from app.models import *
# configure dashboard
dashboard.config.init_from(file=os.path.join(basedir, 'flask_monitoringdashboard.cfg'))
dashboard.bind(app)
# configure rq
redis = Redis.from_url(app.config['REDIS_URI'])
task_queue = Queue(connection=redis)
......
......@@ -15,7 +15,7 @@ class Share(db.Model):
password = db.Column('Password', db.String, nullable=True)
is_zipped = db.Column('Zipped', db.Boolean, nullable=False, default=False)
files = db.relationship('Attachment', cascade="all,delete", backref='share')
files = db.relationship('Attachment', backref='share')
def __repr__(self):
return f'<Share {self.id}>'
......@@ -46,7 +46,7 @@ class Attachment(db.Model):
id = db.Column('ID', db.INTEGER, primary_key=True, unique=True)
filename = db.Column('filename', db.String(), nullable=False)
filesize = db.Column('filesize', db.Integer(), nullable=False, default=0) # in bytes
share_id = db.Column('ShareID', db.String(64), db.ForeignKey('Share.ID'), nullable=False)
share_id = db.Column('ShareID', db.String(64), db.ForeignKey('Share.ID', ondelete='CASCADE'), nullable=False)
def __repr__(self):
return f'<Attachment {self.id}, {self.filename} for Share {self.share_id}>'
......@@ -62,4 +62,4 @@ class Attachment(db.Model):
file.save(path)
self.filesize = os.path.getsize(path)
except OSError as e:
print(e)
\ No newline at end of file
print(e)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment