Skip to content

Commit

Permalink
db: github link alembic migration
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangvi7 committed Oct 18, 2024
1 parent 846ac5e commit 940d8fb
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "querybook",
"version": "3.34.2",
"version": "3.35.0",
"description": "A Big Data Webapp",
"private": true,
"scripts": {
Expand Down
97 changes: 97 additions & 0 deletions querybook/migrations/versions/a8bb37120302_add_github_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""Add Github Link
Revision ID: a8bb37120302
Revises: f7b11b3e3a95
Create Date: 2024-10-18 15:50:51.471760
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'a8bb37120302'
down_revision = 'f7b11b3e3a95'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('github_link',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('datadoc_id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('repo_url', sa.String(length=255), nullable=False),
sa.Column('branch', sa.String(length=255), nullable=False),
sa.Column('file_path', sa.String(length=255), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['datadoc_id'], ['data_doc.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('datadoc_id')
)
op.alter_column('board_editor', 'board_id',
existing_type=mysql.INTEGER(),
nullable=True)
op.alter_column('board_editor', 'uid',
existing_type=mysql.INTEGER(),
nullable=True)
op.drop_constraint('board_item_ibfk_1', 'board_item', type_='foreignkey')
op.create_foreign_key(None, 'board_item', 'board', ['parent_board_id'], ['id'])
op.alter_column('data_doc_dag_export', 'created_at',
existing_type=mysql.DATETIME(),
nullable=False)
op.alter_column('data_doc_dag_export', 'updated_at',
existing_type=mysql.DATETIME(),
nullable=False)
op.alter_column('environment', 'shareable',
existing_type=mysql.TINYINT(display_width=1),
nullable=False,
existing_server_default=sa.text("'1'"))
op.drop_constraint('event_log_ibfk_1', 'event_log', type_='foreignkey')
op.alter_column('user_group_member', 'gid',
existing_type=mysql.INTEGER(),
nullable=True)
op.alter_column('user_group_member', 'uid',
existing_type=mysql.INTEGER(),
nullable=True)
op.alter_column('user_group_member', 'created_at',
existing_type=mysql.DATETIME(),
nullable=True)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('user_group_member', 'created_at',
existing_type=mysql.DATETIME(),
nullable=False)
op.alter_column('user_group_member', 'uid',
existing_type=mysql.INTEGER(),
nullable=False)
op.alter_column('user_group_member', 'gid',
existing_type=mysql.INTEGER(),
nullable=False)
op.create_foreign_key('event_log_ibfk_1', 'event_log', 'user', ['uid'], ['id'])
op.alter_column('environment', 'shareable',
existing_type=mysql.TINYINT(display_width=1),
nullable=True,
existing_server_default=sa.text("'1'"))
op.alter_column('data_doc_dag_export', 'updated_at',
existing_type=mysql.DATETIME(),
nullable=True)
op.alter_column('data_doc_dag_export', 'created_at',
existing_type=mysql.DATETIME(),
nullable=True)
op.drop_constraint(None, 'board_item', type_='foreignkey')
op.create_foreign_key('board_item_ibfk_1', 'board_item', 'board', ['parent_board_id'], ['id'], ondelete='CASCADE')
op.alter_column('board_editor', 'uid',
existing_type=mysql.INTEGER(),
nullable=False)
op.alter_column('board_editor', 'board_id',
existing_type=mysql.INTEGER(),
nullable=False)
op.drop_table('github_link')
# ### end Alembic commands ###

0 comments on commit 940d8fb

Please sign in to comment.