Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dp): Add available frequencies column #13089

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""empty message

Revision ID: 530b18568ad9
Revises: b5caf147315e
Create Date: 2022-06-27 15:55:48.080182

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = '530b18568ad9'
down_revision = 'b5caf147315e'
branch_labels = None
depends_on = None


def upgrade():
"""
Run upgrade
"""
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('cbsds', sa.Column('available_frequencies', sa.JSON(), nullable=True))
# ### end Alembic commands ###


def downgrade():
"""
Run downgrade
"""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('cbsds', 'available_frequencies')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions dp/cloud/python/magma/db_service/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class DBCbsd(Base):
carrier_aggregation_enabled = Column(Boolean, nullable=False, server_default='false')
max_ibw_mhz = Column(Integer, nullable=False, server_default='150')
grant_redundancy = Column(Boolean, nullable=False, server_default='true')
available_frequencies = Column(JSON)
created_date = Column(
DateTime(timezone=True),
nullable=False, server_default=now(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Copyright 2022 The Magma Authors.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from magma.db_service.tests.alembic_testcase import AlembicTestCase

# TODO make some generic test for migration with only column changes
TABLE = 'cbsds'
COLUMN = 'available_frequencies'


class Test530b18568ad9TestCase(AlembicTestCase):
down_revision = 'b5caf147315e'
up_revision = '530b18568ad9'

def setUp(self) -> None:
super().setUp()
self.upgrade(self.down_revision)

def test_upgrade(self):
self.upgrade()
self.assertTrue(self.has_column(self.get_table(TABLE), COLUMN))

def test_columns_present_post_upgrade(self):
self.upgrade()
self.downgrade()
self.assertFalse(self.has_column(self.get_table(TABLE), COLUMN))