ciclos

ref: configuration

src/alembic/versions/a848d1c82ba0_set_initial_configuration.py


 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""set initial configuration

Revision ID: a848d1c82ba0
Revises: b80a277fdc89
Create Date: 2020-01-14 01:03:35.088003

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a848d1c82ba0'
down_revision = 'b80a277fdc89'
branch_labels = None
depends_on = None


def upgrade():
  op.execute("""
    INSERT INTO configurations (
      purchase_duration,
      purchase_duration_type,
      delivery_duration,
      delivery_duration_type,
      created_at,
      updated_at
    )
    VALUES (
      3.0,
      'days',
      2,
      'hours',
      NOW(),
      NOW()
    );
  """)


def downgrade():
  op.execute("""
    DELETE FROM configurations;
  """)