deb-designate/designate/backend/impl_powerdns/models.py
Endre Karlson 9d5d70e7f1 Switch to oslo.db and fix cmd.manage
This change doesn't remove all of the d.sqla.* modules for compat so we don't
need to change more things then needed. Things like multiple engines etc are
supported via a _FACADE dict in d.sqla.session and other things we need as
well.

We remove d.o.common.db code since it is not needed anymore and technically
replaced by oslo.db.

Notably the *biggest* change is changing database_connection to connection.

Also fixes problems with arguments in cmd.manage

Change-Id: I948a42b7f3dbc1d484200e86b3f8d0b85769ad08
2014-06-20 15:27:54 +02:00

79 lines
2.7 KiB
Python

# Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved.
# Copyright 2012 Managed I.T.
#
# Author: Patrick Galbraith <patg@hp.com>
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import Column, String, Text, Integer, Boolean
from sqlalchemy.ext.declarative import declarative_base
from designate.sqlalchemy import models
from designate.sqlalchemy.types import UUID
class Base(models.Base):
id = Column(Integer, primary_key=True, autoincrement=True)
Base = declarative_base(cls=Base)
class TsigKey(Base):
__tablename__ = 'tsigkeys'
designate_id = Column(UUID, nullable=False)
name = Column(String(255), default=None, nullable=True)
algorithm = Column(String(255), default=None, nullable=True)
secret = Column(String(255), default=None, nullable=True)
class DomainMetadata(Base):
__tablename__ = 'domainmetadata'
domain_id = Column(Integer(), nullable=False)
kind = Column(String(16), default=None, nullable=True)
content = Column(Text())
class Domain(Base):
__tablename__ = 'domains'
designate_id = Column(UUID, nullable=False)
name = Column(String(255), nullable=False, unique=True)
master = Column(String(255), nullable=True)
last_check = Column(Integer, default=None, nullable=True)
type = Column(String(6), nullable=False)
notified_serial = Column(Integer, default=None, nullable=True)
account = Column(String(40), default=None, nullable=True)
class Record(Base):
__tablename__ = 'records'
designate_id = Column(UUID, nullable=False)
designate_recordset_id = Column(UUID, default=None, nullable=True)
domain_id = Column(Integer, default=None, nullable=True)
name = Column(String(255), default=None, nullable=True)
type = Column(String(10), default=None, nullable=True)
content = Column(Text, default=None, nullable=True)
ttl = Column(Integer, default=None, nullable=True)
prio = Column(Integer, default=None, nullable=True)
change_date = Column(Integer, default=None, nullable=True)
ordername = Column(String(255), default=None, nullable=True)
auth = Column(Boolean(), default=None, nullable=True)
inherit_ttl = Column(Boolean(), default=True)