Small db tables adjustments

This commit is contained in:
grossmj 2021-09-04 15:23:25 +09:30
parent d606553e20
commit f1ecb02160
3 changed files with 9 additions and 9 deletions

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from sqlalchemy import Column, String from sqlalchemy import Column, String, Integer
from .base import BaseTable, GUID from .base import BaseTable, GUID
@ -28,6 +28,6 @@ class Compute(BaseTable):
name = Column(String, index=True) name = Column(String, index=True)
protocol = Column(String) protocol = Column(String)
host = Column(String) host = Column(String)
port = Column(String) port = Column(Integer)
user = Column(String) user = Column(String)
password = Column(String) password = Column(String)

View File

@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from sqlalchemy import Table, Column, String, Integer, ForeignKey, BigInteger from sqlalchemy import Table, Column, String, ForeignKey, BigInteger
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
from .base import Base, BaseTable, GUID from .base import Base, BaseTable, GUID
@ -24,7 +24,7 @@ from .base import Base, BaseTable, GUID
image_template_link = Table( image_template_link = Table(
"images_templates_link", "images_templates_link",
Base.metadata, Base.metadata,
Column("image_id", Integer, ForeignKey("images.id", ondelete="CASCADE")), Column("image_id", BigInteger, ForeignKey("images.image_id", ondelete="CASCADE")),
Column("template_id", GUID, ForeignKey("templates.template_id", ondelete="CASCADE")) Column("template_id", GUID, ForeignKey("templates.template_id", ondelete="CASCADE"))
) )
@ -33,11 +33,11 @@ class Image(BaseTable):
__tablename__ = "images" __tablename__ = "images"
id = Column(Integer, primary_key=True, autoincrement=True) image_id = Column(BigInteger, primary_key=True, autoincrement=True)
filename = Column(String) filename = Column(String, index=True)
path = Column(String, unique=True)
image_type = Column(String) image_type = Column(String)
image_size = Column(BigInteger) image_size = Column(BigInteger)
path = Column(String, unique=True, index=True) checksum = Column(String, index=True)
checksum = Column(String)
checksum_algorithm = Column(String) checksum_algorithm = Column(String)
templates = relationship("Template", secondary=image_template_link, back_populates="images") templates = relationship("Template", secondary=image_template_link, back_populates="images")

View File

@ -33,9 +33,9 @@ class Template(BaseTable):
default_name_format = Column(String) default_name_format = Column(String)
symbol = Column(String) symbol = Column(String)
builtin = Column(Boolean, default=False) builtin = Column(Boolean, default=False)
compute_id = Column(String)
usage = Column(String) usage = Column(String)
template_type = Column(String) template_type = Column(String)
compute_id = Column(String)
images = relationship("Image", secondary=image_template_link, back_populates="templates") images = relationship("Image", secondary=image_template_link, back_populates="templates")
__mapper_args__ = { __mapper_args__ = {