예제 #1
0
class TermTaxonomy(db.Model):

    __tablename__ = "wp_term_taxonomy"

    term_taxonomy_id = db.Column('term_taxonomy_id',
                                 db.Integer(),
                                 primary_key=True,
                                 nullable=False)
    term_id = db.Column('term_id',
                        db.Integer(),
                        primary_key=False,
                        nullable=False)
    taxonomy = db.Column('taxonomy',
                         db.String(length=32),
                         primary_key=False,
                         nullable=False)
    description = db.Column('description',
                            db.Text(length=None),
                            primary_key=False,
                            nullable=False)
    parent = db.Column('parent',
                       db.Integer(),
                       primary_key=False,
                       nullable=False)
    count = db.Column('count', db.Integer(), primary_key=False, nullable=False)
    db.UniqueConstraint('term_id', 'taxonomy')
    db.ForeignKeyConstraint(['term_id'], ['wp_terms.term_id'])
    db.ForeignKeyConstraint(['parent'], ['wp_term_taxonomy.term_taxonomy_id'])
예제 #2
0
class Post(db.Model):
    
    __tablename__ = "wp_posts"

    post_id = db.Column('ID', db.Integer(), primary_key=True, nullable=False)
    post_author_id = db.Column('post_author', db.Integer(), db.ForeignKey('wp_users.ID'), primary_key=False, nullable=False)
    post_date = db.Column('post_date', db.DateTime(timezone=False), primary_key=False, nullable=False)
    post_date_gmt = db.Column('post_date_gmt', db.DateTime(timezone=False), primary_key=False, nullable=False)
    post_content = db.Column('post_content', db.Text(length=None), primary_key=False, nullable=False)
    post_title = db.Column('post_title', db.Text(length=None), primary_key=False, nullable=False)
    post_excerpt = db.Column('post_excerpt', db.Text(length=None), primary_key=False, nullable=False)
    post_status = db.Column('post_status', db.String(length=20), primary_key=False, nullable=False)
    comment_status = db.Column('comment_status', db.String(length=20), primary_key=False, nullable=False)
    ping_status = db.Column('ping_status', db.String(length=6), primary_key=False, nullable=False)
    post_password = db.Column('post_password', db.String(length=255), primary_key=False, nullable=False)
    post_name = db.Column('post_name', db.String(length=200), primary_key=False, nullable=False)
    to_ping = db.Column('to_ping', db.Text(length=None), primary_key=False, nullable=False)
    pinged = db.Column('pinged', db.Text(length=None), primary_key=False, nullable=False)
    post_modified = db.Column('post_modified', db.DateTime(timezone=False), primary_key=False, nullable=False)
    post_modified_gmt = db.Column('post_modified_gmt', db.DateTime(timezone=False), primary_key=False, nullable=False)
    post_content_filtered = db.Column('post_content_filtered', db.Text(length=None), primary_key=False, nullable=False)
    post_parent_id = db.Column('post_parent', db.Integer(), db.ForeignKey("wp_posts.ID"), primary_key=False, nullable=False)
    guid = db.Column('guid', db.String(length=255), primary_key=False, nullable=False)
    menu_order = db.Column('menu_order', db.Integer(), primary_key=False, nullable=False)
    post_type = db.Column('post_type', db.String(length=20), primary_key=False, nullable=False)
    post_mime_type = db.Column('post_mime_type', db.String(length=100), primary_key=False, nullable=False)
    comment_count = db.Column('comment_count', db.Integer(), primary_key=False, nullable=False)

    fk_post_author = db.ForeignKeyConstraint(['post_author_id'], ['wp_users.ID'])
    fk_post_parent = db.ForeignKeyConstraint(['post_parent_id'], ['wp_posts.ID'])

    author = db.relationship("User")

    def serialize(self):
        return {
                'post_id': self.post_id,
                'post_author': self.author.serialize(),
                'post_date': self.post_date,
                'post_content': self.post_content,
                'post_title': self.post_title,
                'post_modified': self.post_modified,
                'post_name': self.post_name,
                'post_type': self.post_type,
        }

    def serializeMinimal(self):
        return {
                'post_id': self.post_id,
                'post_author': self.author.serialize(),
                'post_date': self.post_date,
                'post_title': self.post_title,
                'post_modified': self.post_modified,
                'post_name': self.post_name,
                'post_exerpt': self.post_excerpt,
                'post_type': self.post_type,
        }
예제 #3
0
class User(UserMixin, db.Model):
    
    __tablename__ = "wp_users"

    user_id = db.Column('ID', db.Integer(), primary_key=True, nullable=False)
    user_login = db.Column('user_login', db.String(length=60), primary_key=False, nullable=False)
    user_pass = db.Column('user_pass', db.String(length=255), primary_key=False, nullable=False)
    user_nicename = db.Column('user_nicename', db.String(length=50), primary_key=False, nullable=False)
    user_email = db.Column('user_email', db.String(length=100), primary_key=False, nullable=False)
    user_url = db.Column('user_url', db.String(length=100), primary_key=False, nullable=False)
    user_registered = db.Column('user_registered', db.DateTime(timezone=False), primary_key=False, nullable=False)
    user_activation_key = db.Column('user_activation_key', db.String(length=255), primary_key=False, nullable=False)
    user_status = db.Column('user_status', db.Integer(), primary_key=False, nullable=False)
    display_name = db.Column('display_name', db.String(length=250), primary_key=False, nullable=False)

    def get_id(self):
        return unicode(self.user_id)

    def serialize(self):

        return {
            'user_id': self.user_id,
            'user_nicename': self.user_nicename,
            'user_email': self.user_email,
            'user_url': self.user_url,
        }
예제 #4
0
class Term(db.Model):

    __tablename__ = "wp_terms"

    term_id = db.Column('term_id',
                        db.Integer(),
                        primary_key=True,
                        nullable=False)
    name = db.Column('name',
                     db.String(length=55),
                     primary_key=False,
                     nullable=False)
    slug = db.Column('slug',
                     db.String(length=200),
                     primary_key=False,
                     nullable=False)
    term_group = db.Column('term_group',
                           db.Integer(),
                           primary_key=False,
                           nullable=False)
    db.UniqueConstraint('slug')
예제 #5
0
class Option(db.Model):

    __tablename__ = "wp_options"

    option_id = db.Column('option_id',
                          db.Integer(),
                          primary_key=True,
                          nullable=False)
    blog_id = db.Column('blog_id',
                        db.Integer(),
                        primary_key=True,
                        nullable=False)
    option_name = db.Column('option_name',
                            db.String(length=64),
                            primary_key=True,
                            nullable=False)
    option_value = db.Column('option_value',
                             db.Text(length=None),
                             primary_key=False,
                             nullable=False)
    autoload = db.Column('autoload',
                         db.String(length=3),
                         primary_key=False,
                         nullable=False)
예제 #6
0
class PostMeta(db.Model):

    __tablename__ = "wp_postmeta"

    meta_id = db.Column('meta_id',
                        db.Integer(),
                        primary_key=True,
                        nullable=False)
    post_id = db.Column('post_id',
                        db.Integer(),
                        primary_key=False,
                        nullable=False)
    meta_key = db.Column('meta_key', db.String(length=255), primary_key=False)
    meta_value = db.Column('meta_value',
                           db.Text(length=None),
                           primary_key=False)
    db.ForeignKeyConstraint(['post_id'], ['wp_posts.ID'])
예제 #7
0
class UserMeta(db.Model):

    __tablename__ = 'wp_usermeta'

    umeta_id = db.Column('umeta_id',
                         db.Integer(),
                         primary_key=True,
                         nullable=False)
    user_id = db.Column('user_id',
                        db.Integer(),
                        primary_key=False,
                        nullable=False)
    meta_key = db.Column('meta_key', db.String(length=255), primary_key=False)
    meta_value = db.Column('meta_value',
                           db.Text(length=None),
                           primary_key=False)
    db.ForeignKeyConstraint(['user_id'], ['wp_users.ID'])
예제 #8
0
class Comment(db.Model):

    __tablename__ = "wp_comments"

    comment_ID = db.Column('comment_ID', db.Integer(), primary_key=True, nullable=False)
    comment_post_ID = db.Column('comment_post_ID', db.Integer(), primary_key=False, nullable=False)
    comment_author = db.Column('comment_author', db.Text(length=None), primary_key=False, nullable=False)
    comment_author_email = db.Column('comment_author_email', db.String(length=100), primary_key=False, nullable=False)
    comment_author_url = db.Column('comment_author_url', db.String(length=200), primary_key=False, nullable=False)
    comment_author_IP = db.Column('comment_author_IP', db.String(length=100), primary_key=False, nullable=False)
    comment_date = db.Column('comment_date', db.DateTime(timezone=False), primary_key=False, nullable=False)
    comment_date_gmt = db.Column('comment_date_gmt', db.DateTime(timezone=False), primary_key=False, nullable=False)
    comment_content = db.Column('comment_content', db.Text(length=None), primary_key=False, nullable=False)
    comment_karma = db.Column('comment_karma', db.Integer(), primary_key=False, nullable=False)
    comment_approved = db.Column('comment_approved', db.String(length=4), primary_key=False, nullable=False)
    comment_agent = db.Column('comment_agent', db.String(length=255), primary_key=False, nullable=False)
    comment_type = db.Column('comment_type', db.String(length=20), primary_key=False, nullable=False)
    comment_parent = db.Column('comment_parent', db.Integer(), primary_key=False, nullable=False)
    user_id = db.Column('user_id', db.Integer(), primary_key=False, nullable=False)
    db.ForeignKeyConstraint(['comment_post_ID'], ['wp_posts.ID'])
    db.ForeignKeyConstraint(['comment_parent'], ['wp_comments.comment_ID'])
    db.ForeignKeyConstraint(['user_id'], ['wp_users.ID'])
예제 #9
0
class Link(db.Model):

    __tablename__ = "wp_links"

    link_id = db.Column('link_id',
                        db.Integer(),
                        primary_key=True,
                        nullable=False)
    link_url = db.Column('link_url',
                         db.String(length=255),
                         primary_key=False,
                         nullable=False)
    link_name = db.Column('link_name',
                          db.String(length=255),
                          primary_key=False,
                          nullable=False)
    link_image = db.Column('link_image',
                           db.String(length=255),
                           primary_key=False,
                           nullable=False)
    link_target = db.Column('link_target',
                            db.String(length=25),
                            primary_key=False,
                            nullable=False)
    link_category = db.Column('link_category',
                              db.Integer(),
                              primary_key=False,
                              nullable=False)
    link_description = db.Column('link_description',
                                 db.String(length=255),
                                 primary_key=False,
                                 nullable=False)
    link_visible = db.Column('link_visible',
                             db.String(length=1),
                             primary_key=False,
                             nullable=False)
    link_owner = db.Column('link_owner',
                           db.Integer(),
                           primary_key=False,
                           nullable=False)
    link_rating = db.Column('link_rating',
                            db.Integer(),
                            primary_key=False,
                            nullable=False)
    link_updated = db.Column('link_updated',
                             db.DateTime(timezone=False),
                             primary_key=False,
                             nullable=False)
    link_rel = db.Column('link_rel',
                         db.String(length=255),
                         primary_key=False,
                         nullable=False)
    link_notes = db.Column('link_notes',
                           db.Text(length=None),
                           primary_key=False,
                           nullable=False)
    link_rss = db.Column('link_rss',
                         db.String(length=255),
                         primary_key=False,
                         nullable=False)
    db.ForeignKeyConstraint(['link_owner'], ['wp_users.ID'])