Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Oct 17, 2024
2 parents 8c62b37 + 1cdc840 commit e5be39b
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 25 deletions.
1 change: 0 additions & 1 deletion mycodo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
import binascii
import os
import subprocess
import sys
from datetime import timedelta

Expand Down
4 changes: 2 additions & 2 deletions mycodo/databases/models/alembic_version.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion mycodo/databases/models/camera.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
6 changes: 4 additions & 2 deletions mycodo/databases/models/controller.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

def is_active(self):
"""
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

def __repr__(self):
return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__)
Expand Down
4 changes: 3 additions & 1 deletion mycodo/databases/models/dashboard.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

# TODO: next major revision: delete all below, no longer used
enable_header_buttons = db.Column(db.Boolean, default=True)
Expand Down
2 changes: 1 addition & 1 deletion mycodo/databases/models/display_order.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
14 changes: 8 additions & 6 deletions mycodo/databases/models/function.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')
conditional_import = db.Column(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')
conditional_initialize = db.Column(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')
conditional_status = db.Column(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), 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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')


class ConditionalConditions(CRUDMixin, db.Model):
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='{}')

# Actions
pause_duration = db.Column(db.Float, default=5.0)
Expand Down
6 changes: 4 additions & 2 deletions mycodo/databases/models/input.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

def is_active(self):
"""
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

def __repr__(self):
return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__)
Expand Down
1 change: 0 additions & 1 deletion mycodo/databases/models/measurement.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions mycodo/databases/models/misc.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')
custom_layout = db.Column(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

# Measurement database
db_name = 'influxdb' # Default
Expand Down
4 changes: 3 additions & 1 deletion mycodo/databases/models/notes.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default=None)

def __repr__(self):
return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__)
Expand Down
6 changes: 4 additions & 2 deletions mycodo/databases/models/output.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

# TODO; Delete at next major version
# No longer used
Expand Down Expand Up @@ -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(db.Text().with_variant(LONGTEXT, "mysql", "mariadb"), default='')

def __repr__(self):
return "<{cls}(id={s.id})>".format(s=self, cls=self.__class__.__name__)
Expand Down
2 changes: 1 addition & 1 deletion mycodo/databases/models/remote.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion mycodo/databases/models/smtp.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down

0 comments on commit e5be39b

Please sign in to comment.