184f1bbcb916_language_und   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A downgrade() 0 5 1
A upgrade() 0 3 1
1
"""language_und
2
3
Revision ID: 184f1bbcb916
4
Revises: 6dfc3e2324aa
5
Create Date: 2017-07-25 16:38:39.439673
6
7
"""
8
import sqlalchemy as sa
9
from alembic import op
10
from sqlalchemy.orm import Session
11
from sqlalchemy.sql import column
12
from sqlalchemy.sql import table
13
14
# revision identifiers, used by Alembic.
15
revision = "184f1bbcb916"
16
down_revision = "6dfc3e2324aa"
17
18
19
language_table = table("language", column("id", sa.String), column("name", sa.String))
20
21
22
def upgrade():
23
24
    op.bulk_insert(language_table, [{"id": "und", "name": "Undetermined"}])
25
26
27
def downgrade():
28
    connection = op.get_bind()
29
    session = Session(bind=connection)
30
    connection.execute(language_table.delete().where(language_table.c.id == "und"))
31
    session.flush()
32