Coverage for /builds/BuildGrid/buildgrid/buildgrid/server/sql/alembic/versions/fcb6e8f09a1d_add_bots_table.py: 76.47%

17 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-10-04 17:48 +0000

1# Copyright (C) 2020 Bloomberg LP 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# <http://www.apache.org/licenses/LICENSE-2.0> 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15"""add bots table 

16 

17Revision ID: fcb6e8f09a1d 

18Revises: b57c30a687fa 

19Create Date: 2023-06-07 11:10:58.114752 

20 

21""" 

22import sqlalchemy as sa 

23from alembic import op 

24 

25# revision identifiers, used by Alembic. 

26revision = "fcb6e8f09a1d" 

27down_revision = "b57c30a687fa" 

28branch_labels = None 

29depends_on = None 

30 

31 

32def upgrade() -> None: 

33 # ### commands auto generated by Alembic - please adjust! ### 

34 op.create_table( 

35 "bots", 

36 sa.Column("name", sa.String(), nullable=False), 

37 sa.Column("bot_id", sa.String(), nullable=False), 

38 sa.Column("last_update_timestamp", sa.DateTime(), nullable=False), 

39 sa.Column("bot_status", sa.Integer(), nullable=False), 

40 sa.Column("lease_id", sa.String(), nullable=True), 

41 sa.Column("instance_name", sa.String(), nullable=True), 

42 sa.PrimaryKeyConstraint("name"), 

43 ) 

44 op.create_index(op.f("ix_bots_bot_id"), "bots", ["bot_id"], unique=False) 

45 op.create_index(op.f("ix_bots_last_update_timestamp"), "bots", ["last_update_timestamp"], unique=False) 

46 op.create_index(op.f("ix_bots_name"), "bots", ["name"], unique=False) 

47 # ### end Alembic commands ### 

48 

49 

50def downgrade() -> None: 

51 # ### commands auto generated by Alembic - please adjust! ### 

52 op.drop_index(op.f("ix_bots_name"), table_name="bots") 

53 op.drop_index(op.f("ix_bots_last_update_timestamp"), table_name="bots") 

54 op.drop_index(op.f("ix_bots_bot_id"), table_name="bots") 

55 op.drop_table("bots") 

56 # ### end Alembic commands ###