summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-07-12 19:36:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-07-12 19:38:56 -0400
commit8033c78a52b25a5145557a21630d10a34f2209e5 (patch)
treeba2674ccfd4db9d5f7ed9b5cb0474430d08bcf18 /tests
parent4fbf99a6ad9f022888ddf709d1e9744d19a76ca6 (diff)
downloadalembic-8033c78a52b25a5145557a21630d10a34f2209e5.tar.gz
implement SQLite RENAME TABLE w schema syntax
Fixed bug where the SQLite implementation of :meth:`.Operations.rename_table` would render an explicit schema name for both the old and new table name, which while is the standard ALTER syntax, is not accepted by SQLite's syntax which doesn't support a rename across schemas. In particular, the syntax issue would prevent batch mode from working for SQLite databases that made use of attached databases (which are treated as "schemas" in SQLAlchemy). Change-Id: I02d8163b39cd33568c7528158218828ff0813695 Fixes: #1065
Diffstat (limited to 'tests')
-rw-r--r--tests/test_sqlite.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py
index 3915343..b8edeaa 100644
--- a/tests/test_sqlite.py
+++ b/tests/test_sqlite.py
@@ -81,6 +81,11 @@ class SQLiteTest(TestBase):
op.add_column("t1", Column("c1", Integer, comment="c1 comment"))
context.assert_("ALTER TABLE t1 ADD COLUMN c1 INTEGER")
+ def test_rename_table_w_schema(self):
+ context = op_fixture("sqlite")
+ op.rename_table("old_name", "new_name", schema="my_schema")
+ context.assert_("ALTER TABLE my_schema.old_name RENAME TO new_name")
+
class SQLiteDefaultCompareTest(TestBase):
__only_on__ = "sqlite"