diff libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py @ 4270:0d7bb4df2343

Reformatted code base using black.
author Goffi <goffi@goffi.org>
date Wed, 19 Jun 2024 18:44:57 +0200
parents 4b842c1fb686
children
line wrap: on
line diff
--- a/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py	Tue Jun 18 12:06:45 2024 +0200
+++ b/libervia/backend/memory/migration/versions/4b002773cf92_add_origin_id_column_to_history_and_.py	Wed Jun 19 18:44:57 2024 +0200
@@ -5,56 +5,43 @@
 Create Date: 2022-06-13 16:10:39.711634
 
 """
+
 from alembic import op
 import sqlalchemy as sa
 
 
 # revision identifiers, used by Alembic.
-revision = '4b002773cf92'
-down_revision = '79e5f3313fa4'
+revision = "4b002773cf92"
+down_revision = "79e5f3313fa4"
 branch_labels = None
 depends_on = None
 
 
 def upgrade():
-    with op.batch_alter_table('history', schema=None) as batch_op:
-        batch_op.add_column(sa.Column('origin_id', sa.Text(), nullable=True))
-        batch_op.create_unique_constraint('uq_origin_id', ['profile_id', 'origin_id', 'source'])
+    with op.batch_alter_table("history", schema=None) as batch_op:
+        batch_op.add_column(sa.Column("origin_id", sa.Text(), nullable=True))
+        batch_op.create_unique_constraint(
+            "uq_origin_id", ["profile_id", "origin_id", "source"]
+        )
 
-    with op.batch_alter_table('message', schema=None) as batch_op:
-        batch_op.alter_column('history_uid',
-               existing_type=sa.TEXT(),
-               nullable=False)
-        batch_op.alter_column('message',
-               existing_type=sa.TEXT(),
-               nullable=False)
+    with op.batch_alter_table("message", schema=None) as batch_op:
+        batch_op.alter_column("history_uid", existing_type=sa.TEXT(), nullable=False)
+        batch_op.alter_column("message", existing_type=sa.TEXT(), nullable=False)
 
-    with op.batch_alter_table('subject', schema=None) as batch_op:
-        batch_op.alter_column('history_uid',
-               existing_type=sa.TEXT(),
-               nullable=False)
-        batch_op.alter_column('subject',
-               existing_type=sa.TEXT(),
-               nullable=False)
+    with op.batch_alter_table("subject", schema=None) as batch_op:
+        batch_op.alter_column("history_uid", existing_type=sa.TEXT(), nullable=False)
+        batch_op.alter_column("subject", existing_type=sa.TEXT(), nullable=False)
 
 
 def downgrade():
-    with op.batch_alter_table('subject', schema=None) as batch_op:
-        batch_op.alter_column('subject',
-               existing_type=sa.TEXT(),
-               nullable=True)
-        batch_op.alter_column('history_uid',
-               existing_type=sa.TEXT(),
-               nullable=True)
+    with op.batch_alter_table("subject", schema=None) as batch_op:
+        batch_op.alter_column("subject", existing_type=sa.TEXT(), nullable=True)
+        batch_op.alter_column("history_uid", existing_type=sa.TEXT(), nullable=True)
 
-    with op.batch_alter_table('message', schema=None) as batch_op:
-        batch_op.alter_column('message',
-               existing_type=sa.TEXT(),
-               nullable=True)
-        batch_op.alter_column('history_uid',
-               existing_type=sa.TEXT(),
-               nullable=True)
+    with op.batch_alter_table("message", schema=None) as batch_op:
+        batch_op.alter_column("message", existing_type=sa.TEXT(), nullable=True)
+        batch_op.alter_column("history_uid", existing_type=sa.TEXT(), nullable=True)
 
-    with op.batch_alter_table('history', schema=None) as batch_op:
-        batch_op.drop_constraint('uq_origin_id', type_='unique')
-        batch_op.drop_column('origin_id')
+    with op.batch_alter_table("history", schema=None) as batch_op:
+        batch_op.drop_constraint("uq_origin_id", type_="unique")
+        batch_op.drop_column("origin_id")