[odrs-web/barthalion/analytic_id: 4/5] test




commit 551263c1718ebfd1a3f17f9b7ec971e9f3e768f3
Author: Bartłomiej Piotrowski <b bpiotrowski pl>
Date:   Thu Sep 1 11:36:23 2022 +0200

    test

 migrations/versions/c856bd600df0_initial_migration.py | 4 ++++
 odrs/models.py                                        | 3 +++
 2 files changed, 7 insertions(+)
---
diff --git a/migrations/versions/c856bd600df0_initial_migration.py 
b/migrations/versions/c856bd600df0_initial_migration.py
index 462ef44..e87332e 100644
--- a/migrations/versions/c856bd600df0_initial_migration.py
+++ b/migrations/versions/c856bd600df0_initial_migration.py
@@ -22,7 +22,11 @@ def upgrade():
     sa.Column('datestr', sa.Integer(), nullable=False),
     sa.Column('app_id', sa.String(length=128), nullable=False),
     sa.Column('fetch_cnt', sa.Integer(), nullable=True),
+    sa.Column("date_appid", sa.String(length=128), nullable=False),
+    sa.Column('analytic_id', sa.BigInteger(), nullable=False),
     sa.PrimaryKeyConstraint('datestr', 'app_id'),
+    sa.PrimaryKeyConstraint('analytic_id'),
+    sa.UniqueConstraint('analytic_id'),
     mysql_character_set='utf8mb4'
     )
     op.create_index('datestr', 'analytics', ['datestr', 'app_id'], unique=True)
diff --git a/odrs/models.py b/odrs/models.py
index edbfb50..c4aa93b 100644
--- a/odrs/models.py
+++ b/odrs/models.py
@@ -21,6 +21,8 @@ from sqlalchemy import (
     Boolean,
     Index,
     ForeignKey,
+    UniqueConstraint,
+    BigInteger
 )
 from sqlalchemy.orm import relationship
 
@@ -51,6 +53,7 @@ class Analytic(db.Model):
     datestr = Column(Integer, default=0, primary_key=True)
     app_id = Column(String(128), primary_key=True)
     fetch_cnt = Column(Integer, default=1)
+    analytic_id = Column(BigInteger, primary_key=True, autoincrement=True, unique=True)
 
     def __init__(self):
         self.datestr = None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]