Coverage for /builds/BuildGrid/buildgrid/buildgrid/server/persistence/sql/alembic/versions/316ad77858af_add_blobs_table_for_sqlstorage.py: 90.91%

11 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-06-11 15:37 +0000

1# Copyright (C) 2024 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 blobs table for SQLStorage 

16 

17Revision ID: 316ad77858af 

18Revises: d4efbcc698ca 

19Create Date: 2024-02-20 12:39:33.255751 

20 

21""" 

22import sqlalchemy as sa 

23from alembic import op 

24 

25# revision identifiers, used by Alembic. 

26revision = "316ad77858af" 

27down_revision = "d4efbcc698ca" 

28branch_labels = None 

29depends_on = None 

30 

31 

32def upgrade() -> None: 

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

34 op.create_table( 

35 "blobs", 

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

37 sa.Column("digest_size_bytes", sa.BigInteger(), nullable=False), 

38 sa.Column("data", sa.LargeBinary(), nullable=False), 

39 sa.PrimaryKeyConstraint("digest_hash"), 

40 ) 

41 # ### end Alembic commands ### 

42 

43 

44def downgrade() -> None: 

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

46 op.drop_table("blobs") 

47 # ### end Alembic commands ###