-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update route for logs endpoint (revert back to older version); Comple…
…ted fasl db migrate and upgrade
- Loading branch information
1 parent
bba39d6
commit 162ea6a
Showing
2 changed files
with
126 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
"""Some message | ||
Revision ID: 0145da7deac4 | ||
Revises: fa598c2c8d5e | ||
Create Date: 2024-02-21 22:19:47.208955 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '0145da7deac4' | ||
down_revision = 'fa598c2c8d5e' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('entry__posts__history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('oAuthUser_id', sa.Integer(), nullable=True)) | ||
batch_op.alter_column('timestamp', | ||
existing_type=postgresql.TIMESTAMP(timezone=True), | ||
type_=sa.DateTime(), | ||
existing_nullable=True) | ||
batch_op.drop_index('idx_29176_ix_entry__posts__history_entry_post_id') | ||
batch_op.drop_index('idx_29176_ix_entry__posts__history_oauthuser_id') | ||
batch_op.drop_index('idx_29176_ix_entry__posts__history_timestamp') | ||
batch_op.create_index(batch_op.f('ix_entry__posts__history_entry_post_id'), ['entry_post_id'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_entry__posts__history_oAuthUser_id'), ['oAuthUser_id'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_entry__posts__history_timestamp'), ['timestamp'], unique=False) | ||
batch_op.drop_constraint('entry__posts__history_ibfk_2', type_='foreignkey') | ||
batch_op.create_foreign_key(None, 'o_auth_user', ['oAuthUser_id'], ['id']) | ||
batch_op.drop_column('oauthuser_id') | ||
|
||
with op.batch_alter_table('entry_post', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('openAIsummary', sa.Text(), nullable=True)) | ||
batch_op.add_column(sa.Column('openAIkeyInsights', sa.Text(), nullable=True)) | ||
batch_op.add_column(sa.Column('openAItitle', sa.String(length=1024), nullable=True)) | ||
batch_op.alter_column('timestamp', | ||
existing_type=postgresql.TIMESTAMP(timezone=True), | ||
type_=sa.DateTime(), | ||
existing_nullable=True) | ||
batch_op.drop_index('idx_29181_ix_entry_post_posttype') | ||
batch_op.drop_index('idx_29181_ix_entry_post_timestamp') | ||
batch_op.drop_index('idx_29181_text2summarize_hash') | ||
batch_op.create_index(batch_op.f('ix_entry_post_posttype'), ['posttype'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_entry_post_timestamp'), ['timestamp'], unique=False) | ||
batch_op.create_unique_constraint(None, ['text2summarize_hash']) | ||
batch_op.drop_column('openaikeyinsights') | ||
batch_op.drop_column('openaisummary') | ||
batch_op.drop_column('openaititle') | ||
|
||
with op.batch_alter_table('o_auth_user', schema=None) as batch_op: | ||
batch_op.alter_column('timestamp', | ||
existing_type=postgresql.TIMESTAMP(timezone=True), | ||
type_=sa.DateTime(), | ||
existing_nullable=True) | ||
batch_op.drop_index('idx_29188_ix_o_auth_user_email') | ||
batch_op.drop_index('idx_29188_ix_o_auth_user_linkedin_id') | ||
batch_op.drop_index('idx_29188_ix_o_auth_user_name') | ||
batch_op.drop_index('idx_29188_ix_o_auth_user_timestamp') | ||
batch_op.create_index(batch_op.f('ix_o_auth_user_email'), ['email'], unique=True) | ||
batch_op.create_index(batch_op.f('ix_o_auth_user_linkedin_id'), ['linkedin_id'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_o_auth_user_name'), ['name'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_o_auth_user_timestamp'), ['timestamp'], unique=False) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table('o_auth_user', schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f('ix_o_auth_user_timestamp')) | ||
batch_op.drop_index(batch_op.f('ix_o_auth_user_name')) | ||
batch_op.drop_index(batch_op.f('ix_o_auth_user_linkedin_id')) | ||
batch_op.drop_index(batch_op.f('ix_o_auth_user_email')) | ||
batch_op.create_index('idx_29188_ix_o_auth_user_timestamp', ['timestamp'], unique=False) | ||
batch_op.create_index('idx_29188_ix_o_auth_user_name', ['name'], unique=False) | ||
batch_op.create_index('idx_29188_ix_o_auth_user_linkedin_id', ['linkedin_id'], unique=False) | ||
batch_op.create_index('idx_29188_ix_o_auth_user_email', ['email'], unique=False) | ||
batch_op.alter_column('timestamp', | ||
existing_type=sa.DateTime(), | ||
type_=postgresql.TIMESTAMP(timezone=True), | ||
existing_nullable=True) | ||
|
||
with op.batch_alter_table('entry_post', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('openaititle', sa.VARCHAR(length=1024), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('openaisummary', sa.TEXT(), autoincrement=False, nullable=True)) | ||
batch_op.add_column(sa.Column('openaikeyinsights', sa.TEXT(), autoincrement=False, nullable=True)) | ||
batch_op.drop_constraint(None, type_='unique') | ||
batch_op.drop_index(batch_op.f('ix_entry_post_timestamp')) | ||
batch_op.drop_index(batch_op.f('ix_entry_post_posttype')) | ||
batch_op.create_index('idx_29181_text2summarize_hash', ['text2summarize_hash'], unique=False) | ||
batch_op.create_index('idx_29181_ix_entry_post_timestamp', ['timestamp'], unique=False) | ||
batch_op.create_index('idx_29181_ix_entry_post_posttype', ['posttype'], unique=False) | ||
batch_op.alter_column('timestamp', | ||
existing_type=sa.DateTime(), | ||
type_=postgresql.TIMESTAMP(timezone=True), | ||
existing_nullable=True) | ||
batch_op.drop_column('openAItitle') | ||
batch_op.drop_column('openAIkeyInsights') | ||
batch_op.drop_column('openAIsummary') | ||
|
||
with op.batch_alter_table('entry__posts__history', schema=None) as batch_op: | ||
batch_op.add_column(sa.Column('oauthuser_id', sa.INTEGER(), autoincrement=False, nullable=True)) | ||
batch_op.drop_constraint(None, type_='foreignkey') | ||
batch_op.create_foreign_key('entry__posts__history_ibfk_2', 'o_auth_user', ['oauthuser_id'], ['id']) | ||
batch_op.drop_index(batch_op.f('ix_entry__posts__history_timestamp')) | ||
batch_op.drop_index(batch_op.f('ix_entry__posts__history_oAuthUser_id')) | ||
batch_op.drop_index(batch_op.f('ix_entry__posts__history_entry_post_id')) | ||
batch_op.create_index('idx_29176_ix_entry__posts__history_timestamp', ['timestamp'], unique=False) | ||
batch_op.create_index('idx_29176_ix_entry__posts__history_oauthuser_id', ['oauthuser_id'], unique=False) | ||
batch_op.create_index('idx_29176_ix_entry__posts__history_entry_post_id', ['entry_post_id'], unique=False) | ||
batch_op.alter_column('timestamp', | ||
existing_type=sa.DateTime(), | ||
type_=postgresql.TIMESTAMP(timezone=True), | ||
existing_nullable=True) | ||
batch_op.drop_column('oAuthUser_id') | ||
|
||
# ### end Alembic commands ### |