Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
增加language数据库模型和迁移文件
Browse files Browse the repository at this point in the history
  • Loading branch information
lightless233 committed May 27, 2016
1 parent 163e23c commit 1dd9175
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,14 @@ def __init__(self, name, description, created_at, updated_at):
def __repr__(self):
return "<CobraVuls %r - %r>" % (self.id, self.name)


class CobraSupportLanguage(db.Model):
__tablename__ = 'languages'
id = db.Column(INTEGER(unsigned=True), primary_key=True, autoincrement=True, nullable=False)
language = db.Column(db.String(32), nullable=False)

def __init__(self, language):
self.language = language

def __repr__(self):
return "<CobraSupportLanguage %r - %r>" % (self.id, self.language)
30 changes: 30 additions & 0 deletions migrations/versions/de0dc4a55970_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""empty message
Revision ID: de0dc4a55970
Revises: 89c4f4dde1a1
Create Date: 2016-05-27 16:19:32.109274
"""

# revision identifiers, used by Alembic.
revision = 'de0dc4a55970'
down_revision = '89c4f4dde1a1'

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('languages',
sa.Column('id', mysql.INTEGER(unsigned=True), nullable=False),
sa.Column('language', sa.String(length=32), nullable=False),
sa.PrimaryKeyConstraint('id')
)
### end Alembic commands ###


def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('languages')
### end Alembic commands ###

0 comments on commit 1dd9175

Please sign in to comment.