From a76c8f1d29be9dff00a33932cecf5ed84311759f Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Thu, 28 Jan 2021 11:33:04 +0100
Subject: [PATCH] Remove Corpus.max_nr_of_tokens column, instead set it as
primitve class member
---
web/app/models.py | 4 ++--
web/migrations/versions/8b2e0d43384a_.py | 28 ++++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 web/migrations/versions/8b2e0d43384a_.py
diff --git a/web/app/models.py b/web/app/models.py
index 757e5f40..fdade759 100644
--- a/web/app/models.py
+++ b/web/app/models.py
@@ -518,10 +518,10 @@ class Corpus(db.Model):
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
# Fields
creation_date = db.Column(db.DateTime(), default=datetime.utcnow)
- current_nr_of_tokens = db.Column(db.BigInteger, default=0)
+ current_nr_of_tokens = db.Column(db.Integer, default=0)
description = db.Column(db.String(255))
last_edited_date = db.Column(db.DateTime(), default=datetime.utcnow)
- max_nr_of_tokens = db.Column(db.BigInteger, default=2147483647)
+ max_nr_of_tokens = 2147483647
status = db.Column(db.String(16), default='unprepared')
title = db.Column(db.String(32))
archive_file = db.Column(db.String(255))
diff --git a/web/migrations/versions/8b2e0d43384a_.py b/web/migrations/versions/8b2e0d43384a_.py
new file mode 100644
index 00000000..9cc64a13
--- /dev/null
+++ b/web/migrations/versions/8b2e0d43384a_.py
@@ -0,0 +1,28 @@
+"""empty message
+
+Revision ID: 8b2e0d43384a
+Revises: 790ce9512e75
+Create Date: 2021-01-25 11:18:45.256537
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = '8b2e0d43384a'
+down_revision = '790ce9512e75'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_column('corpora', 'max_nr_of_tokens')
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.add_column('corpora', sa.Column('max_nr_of_tokens', sa.INTEGER(), autoincrement=False, nullable=True))
+ # ### end Alembic commands ###