Skip to content

Commit

Permalink
fix #143
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Dec 6, 2022
1 parent 2432d03 commit e147a04
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 58 deletions.
16 changes: 8 additions & 8 deletions app/alembic/versions/0c07baa8d7b2_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def upgrade() -> None:
op.create_index(op.f('ix_addresses_id'), 'addresses', ['id'], unique=True)
op.create_index(op.f('ix_addresses_usage_point_id'), 'addresses', ['usage_point_id'], unique=False)
op.create_table('consumption_daily',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('id', sa.String(), nullable=False),
sa.Column('usage_point_id', sa.Text(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=False),
sa.Column('value', sa.Integer(), nullable=False),
Expand All @@ -81,7 +81,7 @@ def upgrade() -> None:
op.create_index(op.f('ix_consumption_daily_id'), 'consumption_daily', ['id'], unique=True)
op.create_index(op.f('ix_consumption_daily_usage_point_id'), 'consumption_daily', ['usage_point_id'], unique=False)
op.create_table('consumption_detail',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('id', sa.String(), nullable=False),
sa.Column('usage_point_id', sa.Text(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=False),
sa.Column('value', sa.Integer(), nullable=False),
Expand All @@ -91,7 +91,7 @@ def upgrade() -> None:
sa.Column('fail_count', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['usage_point_id'], ['usage_points.usage_point_id'], ),
sa.PrimaryKeyConstraint('id'),
sqlite_autoincrement=True
# sqlite_autoincrement=True
)
op.create_index(op.f('ix_consumption_detail_id'), 'consumption_detail', ['id'], unique=True)
op.create_index(op.f('ix_consumption_detail_usage_point_id'), 'consumption_detail', ['usage_point_id'], unique=False)
Expand All @@ -116,25 +116,25 @@ def upgrade() -> None:
sa.Column('count', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['usage_point_id'], ['usage_points.usage_point_id'], ),
sa.PrimaryKeyConstraint('id'),
sqlite_autoincrement=True
# sqlite_autoincrement=True
)
op.create_index(op.f('ix_contracts_id'), 'contracts', ['id'], unique=True)
op.create_index(op.f('ix_contracts_usage_point_id'), 'contracts', ['usage_point_id'], unique=False)
op.create_table('production_daily',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('id', sa.String(), nullable=False),
sa.Column('usage_point_id', sa.Text(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=False),
sa.Column('value', sa.Integer(), nullable=False),
sa.Column('blacklist', sa.Integer(), nullable=False),
sa.Column('fail_count', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['usage_point_id'], ['usage_points.usage_point_id'], ),
sa.PrimaryKeyConstraint('id'),
sqlite_autoincrement=True
# sqlite_autoincrement=True
)
op.create_index(op.f('ix_production_daily_id'), 'production_daily', ['id'], unique=True)
op.create_index(op.f('ix_production_daily_usage_point_id'), 'production_daily', ['usage_point_id'], unique=False)
op.create_table('production_detail',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('id', sa.String(), nullable=False),
sa.Column('usage_point_id', sa.Text(), nullable=False),
sa.Column('date', sa.DateTime(), nullable=False),
sa.Column('value', sa.Integer(), nullable=False),
Expand All @@ -144,7 +144,7 @@ def upgrade() -> None:
sa.Column('fail_count', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['usage_point_id'], ['usage_points.usage_point_id'], ),
sa.PrimaryKeyConstraint('id'),
sqlite_autoincrement=True
# sqlite_autoincrement=True
)
op.create_index(op.f('ix_production_detail_id'), 'production_detail', ['id'], unique=True)
op.create_index(op.f('ix_production_detail_usage_point_id'), 'production_detail', ['usage_point_id'], unique=False)
Expand Down
18 changes: 9 additions & 9 deletions app/db_schema.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sqlalchemy import (Column, ForeignKey, Float, Integer, Text, Boolean, DateTime)
from sqlalchemy import (Column, ForeignKey, Float, Integer, Text, Boolean, DateTime, String)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship

Expand Down Expand Up @@ -351,9 +351,9 @@ def __repr__(self):

class ConsumptionDaily(Base):
__tablename__ = 'consumption_daily'
__table_args__ = {'sqlite_autoincrement': True}
# __table_args__ = {'sqlite_autoincrement': True}

id = Column(Integer,
id = Column(String,
primary_key=True,
index=True,
unique=True,
Expand Down Expand Up @@ -393,9 +393,9 @@ def __repr__(self):

class ConsumptionDetail(Base):
__tablename__ = 'consumption_detail'
__table_args__ = {'sqlite_autoincrement': True}
# __table_args__ = {'sqlite_autoincrement': True}

id = Column(Integer,
id = Column(String,
primary_key=True,
index=True,
unique=True,
Expand Down Expand Up @@ -443,9 +443,9 @@ def __repr__(self):

class ProductionDaily(Base):
__tablename__ = 'production_daily'
__table_args__ = {'sqlite_autoincrement': True}
# __table_args__ = {'sqlite_autoincrement': True}

id = Column(Integer,
id = Column(String,
primary_key=True,
index=True,
unique=True,
Expand Down Expand Up @@ -485,9 +485,9 @@ def __repr__(self):

class ProductionDetail(Base):
__tablename__ = 'production_detail'
__table_args__ = {'sqlite_autoincrement': True}
# __table_args__ = {'sqlite_autoincrement': True}

id = Column(Integer,
id = Column(String,
primary_key=True,
index=True,
unique=True,
Expand Down
Loading

0 comments on commit e147a04

Please sign in to comment.