~sircmpwn/names.sr.ht

ref: 4befa4e5942b52045dc9ef9bcd3473389db71d61 names.sr.ht/names/types/domain.py -rw-r--r-- 806 bytes
4befa4e5Drew DeVault Add tables for remaining TLDs with special reqs 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import enum
import sqlalchemy as sa
import sqlalchemy_utils as sau
from srht.database import Base

class DomainStatus(enum.Enum):
    managed = 'managed'
    external = 'external'
    incoming_transfer = 'incoming_transfer'
    outgoing_transfer = 'outgoing_transfer'

class Domain(Base):
    __tablename__ = 'domain'
    id = sa.Column(sa.Integer, primary_key=True)
    created = sa.Column(sa.DateTime, nullable=False)
    updated = sa.Column(sa.DateTime, nullable=False)
    name = sa.Column(sa.String(256), nullable=False)
    status = sa.Column(sau.ChoiceType(DomainStatus, impl=sa.String),
            nullable=False, server_default='external')

    ns1 = sa.Column(sa.String)
    ns2 = sa.Column(sa.String)
    ns3 = sa.Column(sa.String)
    ns4 = sa.Column(sa.String)
    ns5 = sa.Column(sa.String)