Skip to content

Commit d990e1f

Browse files
committed
set limit default -1
1 parent 2b287c5 commit d990e1f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Optional options:
9292

9393
* --offset ("select * from xxx where id > offset")
9494
* --total ("select * from xxx order by id limit total")
95-
* --limit: set the query count in every update, default is 1000, if you set 0, mirage will query all rows one time to update.
95+
* --limit: set the query count in every update, default is 1000, if you set -1, mirage will query all rows one time to update.
9696

9797
Examples
9898

mirage/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def executor(self, apps=None, schema_editor=None, offset=0, total=None, limit=10
4040
else:
4141
db_alias = schema_editor.connection.alias
4242
db_table = model._meta.db_table if model._meta.db_table else f"{self.app}_{self.model}"
43-
if limit == 0:
43+
if limit == -1:
4444
total = model.objects.using(db_alias).count()
4545
else:
4646
if not total:
@@ -56,7 +56,7 @@ def executor(self, apps=None, schema_editor=None, offset=0, total=None, limit=10
5656
while offset < total:
5757
value_list = []
5858
with connections[db_alias].cursor() as cursor:
59-
if limit == 0:
59+
if limit == -1:
6060
cursor.execute(f"select id, {self.field} from {db_table};")
6161
else:
6262
cursor.execute(f"select id, {self.field} from {db_table} where id>{offset} order by id limit {limit};")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
88
setup(
99
name='django-mirage-field',
10-
version='1.1.2',
10+
version='1.1.3',
1111
install_requires=[
1212
"cryptography",
1313
"tqdm",

0 commit comments

Comments
 (0)