Skip to content

Commit 5bd13b8

Browse files
Merge pull request #398 from globocom/develop
Develop
2 parents 7a07fef + 9f47270 commit 5bd13b8

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ It was not created to be and inventory database, so it does not have CMDB functi
3434
## Run Unit Tests
3535
To run the unit tests just run `make build_img && make start && make test_ci` this instruction will run all the unit tests specified in the `networkapi/tests/__init__.py` file.
3636

37+
## Create and run migrations
38+
To create a new migration, just run into app container `cd dbmigrate; db-migrate --new=<MIGRATION_NAME>`. This step will create a enpty migration file, you must write the SQL statement.
39+
To run a migration, just run into app container `cd dbmigrate; db-migrate`. This command will execute all migrations files not executed until now.
40+
3741
## How to contribute
3842
Check this out at
3943
[Contributing](https://github.com/globocom/GloboNetworkAPI/blob/master/CONTRIBUTING.md) file.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#-*- coding:utf-8 -*-
2+
SQL_UP = u"""
3+
ALTER TABLE equipment_list_config_bgp DROP FOREIGN KEY fk_equipment_list_config_bgp_2;
4+
ALTER TABLE equipment_list_config_bgp ADD CONSTRAINT `fk_equipment_list_config_bgp_2` FOREIGN KEY (`id_list_config_bgp`) REFERENCES `list_config_bgp` (`id`)
5+
"""
6+
7+
SQL_DOWN = u"""
8+
ALTER TABLE equipment_list_config_bgp DROP FOREIGN KEY fk_equipment_list_config_bgp_2;
9+
ALTER TABLE equipment_list_config_bgp ADD CONSTRAINT `fk_equipment_list_config_bgp_2` FOREIGN KEY (`id_list_config_bgp`) REFERENCES `route_map` (`id`)
10+
"""

networkapi/api_list_config_bgp/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class EquipmentListConfig(BaseModel):
156156
)
157157
list_config_bgp = models.ForeignKey(
158158
'api_list_config_bgp.ListConfigBGP',
159-
db_column='id_list_config_bgp'
159+
db_column='id'
160160
)
161161

162162
class Meta(BaseModel.Meta):

0 commit comments

Comments
 (0)