File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
tests/apps/migrations/auto Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,27 @@ def test_drop_table(self):
4242 class_names = [i .class_name for i in snapshot ]
4343 self .assertTrue ("Manager" in class_names )
4444
45+ def test_rename_table (self ):
46+ """
47+ Test renaming tables.
48+ """
49+ manager_1 = MigrationManager ()
50+ manager_1 .add_table (class_name = "Band" , tablename = "band" )
51+
52+ manager_2 = MigrationManager ()
53+ manager_2 .rename_table (
54+ old_class_name = "Band" ,
55+ old_tablename = "band" ,
56+ new_class_name = "Performer" ,
57+ new_tablename = "performer" ,
58+ )
59+
60+ schema_snapshot = SchemaSnapshot (managers = [manager_1 , manager_2 ])
61+ snapshot = schema_snapshot .get_snapshot ()
62+
63+ self .assertTrue (snapshot [0 ].class_name == "Performer" )
64+ self .assertTrue (snapshot [0 ].tablename == "performer" )
65+
4566 def test_add_column (self ):
4667 """
4768 Test adding columns.
You can’t perform that action at this time.
0 commit comments