diff --git a/mycodo/config.py b/mycodo/config.py index 2b683b8cf..175093a06 100644 --- a/mycodo/config.py +++ b/mycodo/config.py @@ -4,7 +4,6 @@ # import binascii import os -import subprocess import sys from datetime import timedelta diff --git a/mycodo/databases/models/alembic_version.py b/mycodo/databases/models/alembic_version.py index a1a839864..b2bb8094f 100644 --- a/mycodo/databases/models/alembic_version.py +++ b/mycodo/databases/models/alembic_version.py @@ -1,7 +1,7 @@ # coding=utf-8 -from mycodo.mycodo_flask.extensions import db -from mycodo.databases import CRUDMixin from mycodo import config +from mycodo.databases import CRUDMixin +from mycodo.mycodo_flask.extensions import db class AlembicVersion(CRUDMixin, db.Model): diff --git a/mycodo/databases/models/camera.py b/mycodo/databases/models/camera.py index 81121369a..7fe9a8b57 100644 --- a/mycodo/databases/models/camera.py +++ b/mycodo/databases/models/camera.py @@ -1,7 +1,7 @@ # coding=utf-8 -from mycodo.mycodo_flask.extensions import db from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid +from mycodo.mycodo_flask.extensions import db class Camera(CRUDMixin, db.Model): diff --git a/mycodo/databases/models/controller.py b/mycodo/databases/models/controller.py index d52f72feb..0784165a3 100644 --- a/mycodo/databases/models/controller.py +++ b/mycodo/databases/models/controller.py @@ -1,4 +1,6 @@ # coding=utf-8 +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -18,7 +20,7 @@ class CustomController(CRUDMixin, db.Model): is_activated = db.Column(db.Boolean, default=False) log_level_debug = db.Column(db.Boolean, default=False) - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') def is_active(self): """ @@ -46,7 +48,7 @@ class FunctionChannel(CRUDMixin, db.Model): channel = db.Column(db.Integer, default=None) name = db.Column(db.Text, default='') - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') def __repr__(self): return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__) diff --git a/mycodo/databases/models/dashboard.py b/mycodo/databases/models/dashboard.py index 1e0653b0f..36281eb80 100644 --- a/mycodo/databases/models/dashboard.py +++ b/mycodo/databases/models/dashboard.py @@ -1,4 +1,6 @@ # coding=utf-8 +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -30,7 +32,7 @@ class Widget(CRUDMixin, db.Model): position_y = db.Column(db.Integer, default=999) width = db.Column(db.Integer, default=6) height = db.Column(db.Integer, default=6) - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') # TODO: next major revision: delete all below, no longer used enable_header_buttons = db.Column(db.Boolean, default=True) diff --git a/mycodo/databases/models/display_order.py b/mycodo/databases/models/display_order.py index 39a59c290..0d4f54cbb 100644 --- a/mycodo/databases/models/display_order.py +++ b/mycodo/databases/models/display_order.py @@ -1,6 +1,6 @@ # coding=utf-8 -from mycodo.mycodo_flask.extensions import db from mycodo.databases import CRUDMixin +from mycodo.mycodo_flask.extensions import db class DisplayOrder(CRUDMixin, db.Model): diff --git a/mycodo/databases/models/function.py b/mycodo/databases/models/function.py index 1ab6f2fb6..8f95a3cdd 100644 --- a/mycodo/databases/models/function.py +++ b/mycodo/databases/models/function.py @@ -1,4 +1,6 @@ # coding=utf-8 +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -28,17 +30,17 @@ class Conditional(CRUDMixin, db.Model): is_activated = db.Column(db.Boolean, default=False) log_level_debug = db.Column(db.Boolean, default=False) - conditional_statement = db.Column(db.Text, default='') - conditional_import = db.Column(db.Text, default='') - conditional_initialize = db.Column(db.Text, default='') - conditional_status = db.Column(db.Text, default='') + conditional_statement = db.Column(LONGTEXT, default='') + conditional_import = db.Column(LONGTEXT, default='') + conditional_initialize = db.Column(LONGTEXT, default='') + conditional_status = db.Column(LONGTEXT, default='') period = db.Column(db.Float, default=60.0) start_offset = db.Column(db.Float, default=10.0) pyro_timeout = db.Column(db.Float, default=30.0) use_pylint = db.Column(db.Boolean, default=True) message_include_code = db.Column(db.Boolean, default=False) - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') class ConditionalConditions(CRUDMixin, db.Model): @@ -135,7 +137,7 @@ class Actions(CRUDMixin, db.Model): function_type = db.Column(db.Text, default='') action_type = db.Column(db.Text, default='') # what action, such as 'email', 'execute command', 'flash LCD' - custom_options = db.Column(db.Text, default='{}') + custom_options = db.Column(LONGTEXT, default='{}') # Actions pause_duration = db.Column(db.Float, default=5.0) diff --git a/mycodo/databases/models/input.py b/mycodo/databases/models/input.py index 24ea282ae..d60a716ca 100644 --- a/mycodo/databases/models/input.py +++ b/mycodo/databases/models/input.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -85,7 +87,7 @@ class Input(CRUDMixin, db.Model): # The Things Network: Data Storage datetime = db.Column(db.DateTime, default=None) - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') def is_active(self): """ @@ -113,7 +115,7 @@ class InputChannel(CRUDMixin, db.Model): channel = db.Column(db.Integer, default=None) name = db.Column(db.Text, default='') - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') def __repr__(self): return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__) diff --git a/mycodo/databases/models/measurement.py b/mycodo/databases/models/measurement.py index 8af1f6bd6..ad27e22b1 100644 --- a/mycodo/databases/models/measurement.py +++ b/mycodo/databases/models/measurement.py @@ -1,6 +1,5 @@ # coding=utf-8 from marshmallow_sqlalchemy.fields import Nested -from sqlalchemy.orm import relationship from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid diff --git a/mycodo/databases/models/misc.py b/mycodo/databases/models/misc.py index 21bc96330..0715e3607 100644 --- a/mycodo/databases/models/misc.py +++ b/mycodo/databases/models/misc.py @@ -1,7 +1,7 @@ # coding=utf-8 import logging -import requests +from sqlalchemy.dialects.mysql import LONGTEXT from mycodo.databases import CRUDMixin, set_uuid from mycodo.mycodo_flask.extensions import db @@ -54,8 +54,8 @@ class Misc(CRUDMixin, db.Model): brand_image_height = db.Column(db.Integer, default=55) favicon_display = db.Column(db.String(16), default='default') brand_favicon = db.Column(db.BLOB, default=b'') - custom_css = db.Column(db.Text, default='') - custom_layout = db.Column(db.Text, default='') + custom_css = db.Column(LONGTEXT, default='') + custom_layout = db.Column(LONGTEXT, default='') # Measurement database db_name = 'influxdb' # Default diff --git a/mycodo/databases/models/notes.py b/mycodo/databases/models/notes.py index f92167542..586d136ff 100644 --- a/mycodo/databases/models/notes.py +++ b/mycodo/databases/models/notes.py @@ -1,6 +1,8 @@ # coding=utf-8 import datetime +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -16,7 +18,7 @@ class Notes(CRUDMixin, db.Model): name = db.Column(db.Text, default=None) tags = db.Column(db.Text, default=None) files = db.Column(db.Text, default=None) - note = db.Column(db.Text, default=None) + note = db.Column(LONGTEXT, default=None) def __repr__(self): return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__) diff --git a/mycodo/databases/models/output.py b/mycodo/databases/models/output.py index 685655895..d7e019ede 100644 --- a/mycodo/databases/models/output.py +++ b/mycodo/databases/models/output.py @@ -1,4 +1,6 @@ # coding=utf-8 +from sqlalchemy.dialects.mysql import LONGTEXT + from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid from mycodo.mycodo_flask.extensions import db @@ -32,7 +34,7 @@ class Output(CRUDMixin, db.Model): uart_location = db.Column(db.Text, default=None) # Device location for UART communication baud_rate = db.Column(db.Integer, default=None) # Baud rate for UART communication - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') # TODO; Delete at next major version # No longer used @@ -80,7 +82,7 @@ class OutputChannel(CRUDMixin, db.Model): channel = db.Column(db.Integer, default=None) name = db.Column(db.Text, default='') - custom_options = db.Column(db.Text, default='') + custom_options = db.Column(LONGTEXT, default='') def __repr__(self): return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__) diff --git a/mycodo/databases/models/remote.py b/mycodo/databases/models/remote.py index f1545a282..a6fbd2874 100644 --- a/mycodo/databases/models/remote.py +++ b/mycodo/databases/models/remote.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from mycodo.mycodo_flask.extensions import db from mycodo.databases import CRUDMixin from mycodo.databases import set_uuid +from mycodo.mycodo_flask.extensions import db class Remote(CRUDMixin, db.Model): diff --git a/mycodo/databases/models/smtp.py b/mycodo/databases/models/smtp.py index 1f8b3372b..0bf99ef88 100644 --- a/mycodo/databases/models/smtp.py +++ b/mycodo/databases/models/smtp.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from mycodo.mycodo_flask.extensions import db from mycodo.databases import CRUDMixin +from mycodo.mycodo_flask.extensions import db class SMTP(CRUDMixin, db.Model):