Coverage for manila/db/migrations/alembic/versions/221a83cfd85b_change_user_project_id_length.py: 100%

20 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +0000

1# Copyright 2016 SAP SE 

2# 

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

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

5# 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, WITHOUT 

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

12# License for the specific language governing permissions and limitations 

13# under the License. 

14 

15"""change_user_id_length 

16 

17Revision ID: 221a83cfd85b 

18Revises: eb6d5544cbbd 

19Create Date: 2016-06-21 14:22:48.314501 

20 

21""" 

22 

23# revision identifiers, used by Alembic. 

24revision = '221a83cfd85b' 

25down_revision = 'eb6d5544cbbd' 

26 

27from alembic import op 

28from oslo_log import log 

29import sqlalchemy as sa 

30 

31LOG = log.getLogger(__name__) 

32 

33 

34def upgrade(): 

35 LOG.info("Changing user_id length for share_networks") 

36 op.alter_column("share_networks", "user_id", 

37 type_=sa.String(length=255)) 

38 

39 LOG.info("Changing project_id length for share_networks") 

40 op.alter_column("share_networks", "project_id", 

41 type_=sa.String(length=255)) 

42 

43 LOG.info("Changing project_id length for security_services") 

44 op.alter_column("security_services", "project_id", 

45 type_=sa.String(length=255)) 

46 

47 

48def downgrade(): 

49 LOG.info("Changing back user_id length for share_networks") 

50 op.alter_column("share_networks", "user_id", 

51 type_=sa.String(length=36)) 

52 

53 LOG.info("Changing back project_id length for share_networks") 

54 op.alter_column("share_networks", "project_id", 

55 type_=sa.String(length=36)) 

56 

57 LOG.info("Changing back project_id length for security_services") 

58 op.alter_column("security_services", "project_id", 

59 type_=sa.String(length=36))