-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proper professor table migration (#841)
* revert changes to migration files * generate migration for professors table with updated columns
- Loading branch information
Showing
3 changed files
with
68 additions
and
20 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
58 changes: 58 additions & 0 deletions
58
src/api/migrations/versions/2023-11-03_make_professor_column_names_match_json_.py
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,58 @@ | ||
"""make professor column names match json file | ||
Revision ID: c0289fddf6dd | ||
Revises: 95cb2a021aa9 | ||
Create Date: 2023-11-03 20:51:02.027398 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'c0289fddf6dd' | ||
down_revision = '95cb2a021aa9' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('professor', sa.Column('Department', sa.VARCHAR(length=255), nullable=True)) | ||
op.add_column('professor', sa.Column('Email', sa.VARCHAR(length=255), nullable=False)) | ||
op.add_column('professor', sa.Column('Name', sa.VARCHAR(length=255), nullable=True)) | ||
op.add_column('professor', sa.Column('Phone_number', sa.VARCHAR(length=255), nullable=True)) | ||
op.add_column('professor', sa.Column('Portfolio_page', sa.VARCHAR(length=255), nullable=True)) | ||
op.add_column('professor', sa.Column('Profile_page', sa.VARCHAR(length=255), nullable=True)) | ||
op.add_column('professor', sa.Column('Title', sa.VARCHAR(length=255), nullable=True)) | ||
op.drop_column('professor', 'first_name') | ||
op.drop_column('professor', 'rcs') | ||
op.drop_column('professor', 'last_name') | ||
op.drop_column('professor', 'office_hours_time') | ||
op.drop_column('professor', 'department') | ||
op.drop_column('professor', 'email') | ||
op.drop_column('professor', 'office_room') | ||
op.drop_column('professor', 'phone_number') | ||
op.drop_column('professor', 'classes') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('professor', sa.Column('classes', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('phone_number', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('office_room', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('email', sa.VARCHAR(length=255), autoincrement=False, nullable=False)) | ||
op.add_column('professor', sa.Column('department', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('office_hours_time', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('last_name', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('rcs', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.add_column('professor', sa.Column('first_name', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) | ||
op.drop_column('professor', 'Title') | ||
op.drop_column('professor', 'Profile_page') | ||
op.drop_column('professor', 'Portfolio_page') | ||
op.drop_column('professor', 'Phone_number') | ||
op.drop_column('professor', 'Name') | ||
op.drop_column('professor', 'Email') | ||
op.drop_column('professor', 'Department') | ||
# ### end Alembic commands ### |