Merge "Use `TextClause
` to define the DB model "server_default""
This commit is contained in:
commit
6857d03caa
@ -14,6 +14,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
from sqlalchemy.sql import elements
|
||||
|
||||
# NOTE(boden): This module is common constants for neutron only.
|
||||
# Any constants used outside of neutron should go into neutron-lib.
|
||||
@ -92,3 +93,6 @@ METADATA_V6_CIDR = constants.METADATA_V6_IP + '/128'
|
||||
|
||||
# TODO(haleyb): move this constant to neutron_lib.constants
|
||||
IPV4_MIN_MTU = 68
|
||||
|
||||
# TODO(ralonsoh): move to neutron-lib.db.contants
|
||||
SQL_EMPTY_STRING = elements.TextClause("''")
|
||||
|
@ -16,6 +16,7 @@ import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy import sql
|
||||
|
||||
from neutron.common import _constants as n_const
|
||||
from neutron.db.models import l3 as l3_models
|
||||
from neutron.db import models_v2
|
||||
|
||||
@ -88,7 +89,7 @@ class PortDNS(model_base.BASEV2):
|
||||
dns_name = sa.Column(sa.String(255), nullable=False)
|
||||
dns_domain = sa.Column(sa.String(constants.FQDN_FIELD_SIZE),
|
||||
nullable=False,
|
||||
server_default='')
|
||||
server_default=n_const.SQL_EMPTY_STRING)
|
||||
# Add a relationship to the Port model in order to instruct
|
||||
# SQLAlchemy to eagerly load this association
|
||||
port = orm.relationship(models_v2.Port,
|
||||
|
@ -25,6 +25,7 @@ import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
from sqlalchemy import sql
|
||||
|
||||
from neutron.common import _constants as n_const
|
||||
from neutron.db.network_dhcp_agent_binding import models as ndab_model
|
||||
from neutron.db import rbac_db_models
|
||||
|
||||
@ -296,7 +297,8 @@ class SubnetPool(standard_attr.HasStandardAttributes, model_base.BASEV2,
|
||||
is_default = sa.Column(sa.Boolean, nullable=False,
|
||||
server_default=sql.false())
|
||||
default_quota = sa.Column(sa.Integer, nullable=True)
|
||||
hash = sa.Column(sa.String(36), nullable=False, server_default='')
|
||||
hash = sa.Column(sa.String(36), nullable=False,
|
||||
server_default=n_const.SQL_EMPTY_STRING)
|
||||
address_scope_id = sa.Column(sa.String(36), nullable=True, index=True)
|
||||
prefixes = orm.relationship(SubnetPoolPrefix,
|
||||
backref='subnetpools',
|
||||
|
@ -19,6 +19,7 @@ from neutron_lib.db import model_base
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
||||
from neutron.common import _constants as n_const
|
||||
from neutron.db.models import segment as segment_models
|
||||
from neutron.db import models_v2
|
||||
|
||||
@ -45,10 +46,10 @@ class PortBinding(model_base.BASEV2):
|
||||
default=portbindings.VNIC_NORMAL,
|
||||
server_default=portbindings.VNIC_NORMAL)
|
||||
profile = sa.Column(sa.String(BINDING_PROFILE_LEN), nullable=False,
|
||||
default='', server_default='')
|
||||
default='', server_default=n_const.SQL_EMPTY_STRING)
|
||||
vif_type = sa.Column(sa.String(64), nullable=False)
|
||||
vif_details = sa.Column(sa.String(4095), nullable=False, default='',
|
||||
server_default='')
|
||||
server_default=n_const.SQL_EMPTY_STRING)
|
||||
status = sa.Column(sa.String(16), nullable=False,
|
||||
default=constants.ACTIVE,
|
||||
server_default=constants.ACTIVE)
|
||||
@ -115,12 +116,12 @@ class DistributedPortBinding(model_base.BASEV2):
|
||||
router_id = sa.Column(sa.String(36), nullable=True)
|
||||
vif_type = sa.Column(sa.String(64), nullable=False)
|
||||
vif_details = sa.Column(sa.String(4095), nullable=False, default='',
|
||||
server_default='')
|
||||
server_default=n_const.SQL_EMPTY_STRING)
|
||||
vnic_type = sa.Column(sa.String(64), nullable=False,
|
||||
default=portbindings.VNIC_NORMAL,
|
||||
server_default=portbindings.VNIC_NORMAL)
|
||||
profile = sa.Column(sa.String(BINDING_PROFILE_LEN), nullable=False,
|
||||
default='', server_default='')
|
||||
default='', server_default=n_const.SQL_EMPTY_STRING)
|
||||
status = sa.Column(sa.String(16), nullable=False)
|
||||
|
||||
# Add a relationship to the Port model in order to instruct SQLAlchemy to
|
||||
|
Loading…
Reference in New Issue
Block a user