mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
Automatically generated by the following script, based on the output
of lint with flake8-comma:
import re
import sys
last_filename = None
last_row = None
lines = []
for msg in sys.stdin:
m = re.match(
r"\x1b\[35mflake8 \|\x1b\[0m \x1b\[1;31m(.+):(\d+):(\d+): (\w+)", msg
)
if m:
filename, row_str, col_str, err = m.groups()
row, col = int(row_str), int(col_str)
if filename == last_filename:
assert last_row != row
else:
if last_filename is not None:
with open(last_filename, "w") as f:
f.writelines(lines)
with open(filename) as f:
lines = f.readlines()
last_filename = filename
last_row = row
line = lines[row - 1]
if err in ["C812", "C815"]:
lines[row - 1] = line[: col - 1] + "," + line[col - 1 :]
elif err in ["C819"]:
assert line[col - 2] == ","
lines[row - 1] = line[: col - 2] + line[col - 1 :].lstrip(" ")
if last_filename is not None:
with open(last_filename, "w") as f:
f.writelines(lines)
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
45 lines
2.0 KiB
Python
45 lines
2.0 KiB
Python
# Generated by Django 1.11.23 on 2019-08-23 21:03
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('zerver', '0239_usermessage_copy_id_to_bigint_id'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunSQL(
|
|
"""
|
|
DROP TRIGGER zerver_usermessage_bigint_id_to_id_trigger ON zerver_usermessage;
|
|
DROP FUNCTION zerver_usermessage_bigint_id_to_id_trigger_function();
|
|
|
|
ALTER TABLE zerver_usermessage ALTER COLUMN bigint_id SET NOT NULL;
|
|
ALTER TABLE zerver_usermessage DROP CONSTRAINT zerver_usermessage_pkey;
|
|
DROP SEQUENCE zerver_usermessage_id_seq CASCADE;
|
|
ALTER TABLE zerver_usermessage RENAME COLUMN id to id_old;
|
|
ALTER TABLE zerver_usermessage RENAME COLUMN bigint_id to id;
|
|
ALTER TABLE zerver_usermessage ADD CONSTRAINT zerver_usermessage_pkey PRIMARY KEY USING INDEX zerver_usermessage_bigint_id_idx;
|
|
CREATE SEQUENCE zerver_usermessage_id_seq;
|
|
SELECT SETVAL('zerver_usermessage_id_seq', (SELECT MAX(id)+1 FROM zerver_usermessage));
|
|
ALTER TABLE zerver_usermessage ALTER COLUMN id SET DEFAULT NEXTVAL('zerver_usermessage_id_seq');
|
|
ALTER TABLE zerver_usermessage ALTER COLUMN id_old DROP NOT NULL;
|
|
""",
|
|
state_operations=[
|
|
# This just tells Django to understand executing the above SQL as if it just ran the operations below,
|
|
# so that it knows these model changes are handled and doesn't to generate them on its own
|
|
# in the future makemigration calls.
|
|
migrations.RemoveField(
|
|
model_name='usermessage',
|
|
name='bigint_id',
|
|
),
|
|
migrations.AlterField(
|
|
model_name='usermessage',
|
|
name='id',
|
|
field=models.BigAutoField(primary_key=True, serialize=False),
|
|
),
|
|
],
|
|
),
|
|
]
|