Passed
Push — master ( a36155...798d89 )
by William
01:05
created

7b4195cb191c_Initial Migration.upgrade()   B

Complexity

Conditions 1

Size

Total Lines 61
Code Lines 53

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 53
nop 0
dl 0
loc 61
rs 8.5381
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""Initial Migration
2
3
Revision ID: 7b4195cb191c
4
Revises: 
5
Create Date: 2023-05-22 23:22:29.697375
6
7
"""
8
from alembic import op
9
import sqlalchemy as sa
10
11
12
# revision identifiers, used by Alembic.
13
revision = '7b4195cb191c'
14
down_revision = None
15
branch_labels = None
16
depends_on = None
17
18
19
def upgrade():
20
    # ### commands auto generated by Alembic - please adjust! ###
21
    op.create_table('balance',
22
    sa.Column('id', sa.Integer(), nullable=False),
23
    sa.Column('amount', sa.Numeric(precision=10, scale=2), nullable=True),
24
    sa.Column('date', sa.Date(), nullable=True),
25
    sa.PrimaryKeyConstraint('id')
26
    )
27
    op.create_table('email',
28
    sa.Column('id', sa.Integer(), nullable=False),
29
    sa.Column('email', sa.String(length=100), nullable=True),
30
    sa.Column('password', sa.String(length=100), nullable=True),
31
    sa.Column('server', sa.String(length=100), nullable=True),
32
    sa.PrimaryKeyConstraint('id')
33
    )
34
    op.create_table('running',
35
    sa.Column('id', sa.Integer(), nullable=False),
36
    sa.Column('amount', sa.Numeric(precision=10, scale=2), nullable=True),
37
    sa.Column('date', sa.Date(), nullable=True),
38
    sa.PrimaryKeyConstraint('id')
39
    )
40
    op.create_table('schedule',
41
    sa.Column('id', sa.Integer(), nullable=False),
42
    sa.Column('name', sa.String(length=100), nullable=True),
43
    sa.Column('amount', sa.Numeric(precision=10, scale=2), nullable=True),
44
    sa.Column('frequency', sa.String(length=100), nullable=True),
45
    sa.Column('startdate', sa.Date(), nullable=True),
46
    sa.Column('type', sa.String(length=100), nullable=True),
47
    sa.PrimaryKeyConstraint('id'),
48
    sa.UniqueConstraint('name')
49
    )
50
    op.create_table('settings',
51
    sa.Column('id', sa.Integer(), nullable=False),
52
    sa.Column('name', sa.String(length=100), nullable=True),
53
    sa.Column('value', sa.Boolean(), nullable=True),
54
    sa.PrimaryKeyConstraint('id'),
55
    sa.UniqueConstraint('name')
56
    )
57
    op.create_table('total',
58
    sa.Column('id', sa.Integer(), nullable=False),
59
    sa.Column('amount', sa.Numeric(precision=10, scale=2), nullable=True),
60
    sa.Column('date', sa.Date(), nullable=True),
61
    sa.Column('name', sa.String(length=100), nullable=True),
62
    sa.Column('type', sa.String(length=100), nullable=True),
63
    sa.PrimaryKeyConstraint('id')
64
    )
65
    op.create_table('transactions',
66
    sa.Column('id', sa.Integer(), nullable=False),
67
    sa.Column('name', sa.String(length=100), nullable=True),
68
    sa.Column('date', sa.Date(), nullable=True),
69
    sa.Column('amount', sa.Numeric(precision=10, scale=2), nullable=True),
70
    sa.Column('type', sa.String(length=100), nullable=True),
71
    sa.PrimaryKeyConstraint('id')
72
    )
73
    op.create_table('user',
74
    sa.Column('id', sa.Integer(), nullable=False),
75
    sa.Column('email', sa.String(length=100), nullable=True),
76
    sa.Column('password', sa.String(length=100), nullable=True),
77
    sa.Column('name', sa.String(length=1000), nullable=True),
78
    sa.PrimaryKeyConstraint('id'),
79
    sa.UniqueConstraint('email')
80
    )
81
    # ### end Alembic commands ###
82
83
84
def downgrade():
85
    # ### commands auto generated by Alembic - please adjust! ###
86
    op.drop_table('user')
87
    op.drop_table('transactions')
88
    op.drop_table('total')
89
    op.drop_table('settings')
90
    op.drop_table('schedule')
91
    op.drop_table('running')
92
    op.drop_table('email')
93
    op.drop_table('balance')
94
    # ### end Alembic commands ###
95