Skip to content

Commit

Permalink
upgrade CockroachDB (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantownsend authored Jun 3, 2024
1 parent a4d5a4e commit acaa750
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
cockroachdb-version: ["v22.2.0"]
cockroachdb-version: ["v24.1.0"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
33 changes: 28 additions & 5 deletions tests/apps/migrations/auto/integration/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ def test_text_column(self):
[
x.data_type == "text",
x.is_nullable == "NO",
x.column_default in ("''::text", "'':::STRING"),
x.column_default
in (
"''",
"''::text",
"'':::STRING",
),
]
),
)
Expand Down Expand Up @@ -461,6 +466,7 @@ def test_timestamp_column(self):
in (
"now()",
"CURRENT_TIMESTAMP",
"current_timestamp()::TIMESTAMP",
"current_timestamp():::TIMESTAMPTZ::TIMESTAMP",
),
]
Expand Down Expand Up @@ -541,7 +547,11 @@ def test_interval_column(self):
x.data_type == "interval",
x.is_nullable == "NO",
x.column_default
in ("'00:00:00'::interval", "'00:00:00':::INTERVAL"),
in (
"'00:00:00'",
"'00:00:00'::interval",
"'00:00:00':::INTERVAL",
),
]
),
)
Expand Down Expand Up @@ -743,7 +753,12 @@ def test_jsonb_column(self):
[
x.data_type == "jsonb",
x.is_nullable == "NO",
x.column_default in ("'{}'::jsonb", "'{}':::JSONB"),
x.column_default
in (
"'{}'",
"'{}'::jsonb",
"'{}':::JSONB",
),
]
),
)
Expand All @@ -766,7 +781,11 @@ def test_db_column_name(self):
x.data_type == "character varying",
x.is_nullable == "NO",
x.column_default
in ("''::character varying", "'':::STRING"),
in (
"''",
"''::character varying",
"'':::STRING",
),
]
),
)
Expand All @@ -788,7 +807,11 @@ def test_db_column_name_initial(self):
x.data_type == "character varying",
x.is_nullable == "NO",
x.column_default
in ("''::character varying", "'':::STRING"),
in (
"''",
"''::character varying",
"'':::STRING",
),
]
),
)
Expand Down
30 changes: 15 additions & 15 deletions tests/apps/migrations/auto/test_migration_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,15 +768,15 @@ def test_alter_column_set_default_alt(self):
)

asyncio.run(manager.run())
self.assertEqual(
self._get_column_default(),
[{"column_default": "'Unknown':::STRING"}],
self.assertIn(
self._get_column_default()[0]["column_default"],
["'Unknown'", "'Unknown':::STRING"],
)

asyncio.run(manager.run(backwards=True))
self.assertEqual(
self._get_column_default(),
[{"column_default": "'':::STRING"}],
self.assertIn(
self._get_column_default()[0]["column_default"],
["''", "'':::STRING"],
)

@engines_only("postgres")
Expand Down Expand Up @@ -856,9 +856,9 @@ def test_alter_column_drop_default_alt(self):
old_params={"default": None},
)
asyncio.run(manager_1.run())
self.assertEqual(
self._get_column_default(),
[{"column_default": "'Mr Manager':::STRING"}],
self.assertIn(
self._get_column_default()[0]["column_default"],
["'Mr Manager'", "'Mr Manager':::STRING"],
)

# Drop the default.
Expand All @@ -879,9 +879,9 @@ def test_alter_column_drop_default_alt(self):
# And add it back once more to be sure.
manager_3 = manager_1
asyncio.run(manager_3.run())
self.assertEqual(
self._get_column_default(),
[{"column_default": "'Mr Manager':::STRING"}],
self.assertIn(
self._get_column_default()[0]["column_default"],
["'Mr Manager'", "'Mr Manager':::STRING"],
)

# Run them all backwards
Expand All @@ -892,9 +892,9 @@ def test_alter_column_drop_default_alt(self):
)

asyncio.run(manager_2.run(backwards=True))
self.assertEqual(
self._get_column_default(),
[{"column_default": "'Mr Manager':::STRING"}],
self.assertIn(
self._get_column_default()[0]["column_default"],
["'Mr Manager'", "'Mr Manager':::STRING"],
)

asyncio.run(manager_1.run(backwards=True))
Expand Down

0 comments on commit acaa750

Please sign in to comment.