Add MariaDB database requests and deployment manifests
This commit is contained in:
1 parent
e1dc9a26cb
commit
9746bd8a74
12 files changed
+418
-8
No files matched your search
@@ -1,7 +1,10 @@
|
||||
from django.conf import settings
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
from coulobre.database_node import DATABASE_SUFFIX_PATTERN, INVALID_SUFFIX, DatabaseSpec
|
||||
|
||||
from .fields import DomainNameField
|
||||
|
||||
|
||||
@@ -51,6 +54,34 @@ class HostingAccount(models.Model):
|
||||
return str(self.primary_domain)
|
||||
|
||||
|
||||
class HostingDatabase(models.Model):
|
||||
account = models.ForeignKey(
|
||||
HostingAccount, on_delete=models.PROTECT, related_name="databases"
|
||||
)
|
||||
suffix = models.CharField(
|
||||
"database suffix",
|
||||
max_length=24,
|
||||
validators=[RegexValidator(DATABASE_SUFFIX_PATTERN, INVALID_SUFFIX)],
|
||||
help_text=INVALID_SUFFIX,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ("suffix",)
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
fields=("account", "suffix"),
|
||||
name="hosting_database_account_suffix_unique",
|
||||
)
|
||||
]
|
||||
|
||||
@property
|
||||
def spec(self):
|
||||
return DatabaseSpec(self.account_id, self.suffix)
|
||||
|
||||
def __str__(self):
|
||||
return self.spec.name
|
||||
|
||||
|
||||
class WebProvisioningPlan(models.Model):
|
||||
account = models.ForeignKey(HostingAccount, on_delete=models.CASCADE)
|
||||
primary_domain = DomainNameField(max_length=253)
|
||||
|
||||
Reference in new issue
Block a user