Commit baf1e4c1 authored by Jérome Perrin's avatar Jérome Perrin

testTableStructureMigration: be more independant of mariadb version

With 12f110d4 (testTableStructureMigration: update test after
mariadb 10.3.38, 2023-02-22) we changed the test to support mariadb >=
10.3.38 but it broke the test under 10.3.35.

This makes the test support both 10.3.35 and 10.3.38.
parent eeb590a4
...@@ -115,16 +115,16 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -115,16 +115,16 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` int(11) DEFAULT NULL `a` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
dedent( dedent(
"""\ """\
CREATE TABLE `X` ( CREATE TABLE `X` (
`a` varchar(10) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""")) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""))
# insterting 1 will be casted as string # insterting '1' will be casted as int
self.query("INSERT INTO X VALUES (1)") self.query("INSERT INTO X VALUES ('1')")
self.assertEqual(('1',), self.query("SELECT a FROM X")[1][0]) self.assertEqual((1,), self.query("SELECT a FROM X")[1][0])
def test_change_column_default(self): def test_change_column_default(self):
self.check_upgrade_schema( self.check_upgrade_schema(
...@@ -209,7 +209,7 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase): ...@@ -209,7 +209,7 @@ class TestTableStructureMigrationTestCase(ERP5TypeTestCase):
"""\ """\
CREATE TABLE `table` ( CREATE TABLE `table` (
`and` int(11) DEFAULT NULL, `and` int(11) DEFAULT NULL,
`alter` varchar(255) DEFAULT 'BETWEEN', `alter` varchar(255) CHARACTER SET cp1250 COLLATE cp1250_croatian_ci DEFAULT 'BETWEEN',
KEY `use` (`alter`) KEY `use` (`alter`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""), ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"""),
table_name='table') table_name='table')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment