nebius/SWE-bench-extra huggingface dataset:
Repository: tortoise/tortoise-orm

Issue:
bulk_create ignore_conflicts param does not change query
**Describe the bug**
The ignore_conflicts in the bulk_create function does not change the sql query. It does not add ON CONFLICT DO NOTHING

**To Reproduce*
Using version 0.19.0 and postgres executor
```
print(SomeModel.bulk_create(objects=objects, ignore_conflicts=True).sql()
```

**Expected behavior**
Add "ON CONFLICT DO NOTHING" at the of insert query


Comments:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4cf9422..a2bab96 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -18,6 +18,7 @@ Added
 Fixed
 ^^^^^
 - `TimeField` for `MySQL` will return `datetime.timedelta` object instead of `datetime.time` object.
+- Fix on conflict do nothing. (#1122)
 
 0.19.0
 ------
diff --git a/tortoise/backends/base/executor.py b/tortoise/backends/base/executor.py
index 9dc7590..3cfdec0 100644
--- a/tortoise/backends/base/executor.py
+++ b/tortoise/backends/base/executor.py
@@ -208,7 +208,7 @@ class BaseExecutor:
             .insert(*[self.parameter(i) for i in range(len(columns))])
         )
         if ignore_conflicts:
-            query = query.do_nothing()
+            query = query.on_conflict().do_nothing()
         return query
 
     async def _process_insert_result(self, instance: "Model", results: Any) -> None:
diff --git a/tortoise/backends/base_postgres/executor.py b/tortoise/backends/base_postgres/executor.py
index 39dab14..db34a37 100644
--- a/tortoise/backends/base_postgres/executor.py
+++ b/tortoise/backends/base_postgres/executor.py
@@ -46,7 +46,7 @@ class BasePostgresExecutor(BaseExecutor):
             if generated_fields:
                 query = query.returning(*generated_fields)
         if ignore_conflicts:
-            query = query.do_nothing()
+            query = query.on_conflict().do_nothing()
         return query
 
     async def _process_insert_result(self, instance: Model, results: Optional[dict]) -> None:


Test patch:
diff --git a/tests/test_bulk.py b/tests/test_bulk.py
index 0af5eea..a0875db 100644
--- a/tests/test_bulk.py
+++ b/tests/test_bulk.py
@@ -132,6 +132,7 @@ class TestBulk(test.TruncationTestCase):
     async def test_bulk_create_ignore_conflicts(self):
         name1 = UniqueName(name="name1")
         name2 = UniqueName(name="name2")
+        await UniqueName.bulk_create([name1, name2])
         await UniqueName.bulk_create([name1, name2], ignore_conflicts=True)
         with self.assertRaises(IntegrityError):
             await UniqueName.bulk_create([name1, name2])