{"id":495512,"date":"2026-09-22T06:44:25","date_gmt":"2026-09-22T06:44:25","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=495512"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2026-09-22T06:44:25","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=495512","title":{"rendered":"\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043e\u0442 \u0418\u0418 \u0430\u0433\u0435\u043d\u0442\u0430: \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0431\u044b \u043d\u0435 \u043f\u0443\u0441\u043a\u0430\u043b \u0438\u0445 \u0432 \u043f\u0440\u043e\u0434 \u0431\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e firewall"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Coding agent \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u043b\u043e \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e: \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u043f\u043e\u043b\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0443\u043d\u043a\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u043e. ORM \u0441\u0430\u043c\u0430 \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c DDL, \u0430\u0433\u0435\u043d\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, diff \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u0435\u0441\u0442\u044b \u0437\u0435\u043b\u0451\u043d\u044b\u0435.<\/p>\n<p>\u041d\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u2014 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0432\u0438\u0434 \u043a\u043e\u0434\u0430. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043f\u044f\u0442\u0438 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043c\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0439 blast radius, \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u044b\u0441\u044f\u0447\u0443 \u0441\u0442\u0440\u043e\u043a \u0432 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435. \u041e\u0448\u0438\u0431\u043a\u0430 \u0432 Python \u043e\u0431\u044b\u0447\u043d\u043e \u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439 <code>ALTER TABLE<\/code> \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u043e \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u044a\u0435\u0441\u0442\u044c \u043f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u0445\u0435\u043c\u044b \u0432 \u043e\u0442\u043a\u0430\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>\u0421 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c coding agents \u044d\u0442\u0430 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u0435\u0435. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0430 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0430\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0430\u0433\u0435\u043d\u0442\u043e\u043c, \u043d\u0435 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 diff, \u0430 \u043a\u0430\u043a \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 Terraform, Kubernetes RBAC \u0438\u043b\u0438 CI-\u0441\u0435\u043a\u0440\u0435\u0442\u0430. \u0410\u0433\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c, \u043d\u043e \u043f\u0440\u0430\u0432\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0432 production \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e code review \u0437\u0434\u0435\u0441\u044c \u043c\u0430\u043b\u043e<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 Django: \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430.<\/p>\n<pre><code class=\"python\">class Order(models.Model):    provider_reference = models.CharField(max_length=128)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0410\u0433\u0435\u043d\u0442 \u0432\u0438\u0434\u0438\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442:<\/p>\n<pre><code class=\"python\">class Order(models.Model):    provider_reference = models.CharField(max_length=128, db_index=True)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 <code>makemigrations<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>AddIndex<\/code>. \u041d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e. \u041d\u0430 production-\u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0446\u0435\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f.<\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f PostgreSQL \u043f\u0440\u044f\u043c\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>CREATE INDEX<\/code> \u0438 <code>CREATE INDEX CONCURRENTLY<\/code>: \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a <code>CONCURRENTLY<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c <code>INSERT<\/code>, <code>UPDATE<\/code> \u0438 <code>DELETE<\/code>, \u0445\u043e\u0442\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-createindex.html\" rel=\"noopener nofollow\">PostgreSQL: CREATE INDEX<\/a><\/p>\n<p>\u0412 Django \u0434\u043b\u044f PostgreSQL \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>AddIndexConcurrently<\/code>. \u041e\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. \u041e\u043d\u0430 \u043c\u0435\u043d\u044f\u0435\u0442 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.db import migrations, modelsclass Migration(migrations.Migration):    atomic = False    operations = [        AddIndexConcurrently(            model_name=\"order\",            index=models.Index(                fields=[\"provider_reference\"],                name=\"order_provider_ref_idx\",            ),        ),    ]<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c: <code>CREATE INDEX CONCURRENTLY<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e transaction block. \u0422\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0438\u0441\u043a\u0430 \u0441\u0440\u0430\u0437\u0443 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0430\u043c\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u043e\u0439, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0438 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0451 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.<\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441 \u00ab\u0432\u0430\u043b\u0438\u0434\u0435\u043d \u043b\u0438 \u044d\u0442\u043e\u0442 Python-\u0444\u0430\u0439\u043b?\u00bb \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u041d\u0443\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439: \u00ab\u0447\u0442\u043e \u044d\u0442\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0441 \u0436\u0438\u0432\u043e\u0439 \u0431\u0430\u0437\u043e\u0439, \u043f\u043e\u043a\u0430 \u0440\u044f\u0434\u043e\u043c \u0438\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b?\u00bb<\/p>\n<h3>\u0410\u0433\u0435\u043d\u0442 \u0432\u0438\u0434\u0438\u0442 \u0441\u0445\u0435\u043c\u0443. Production \u0432\u0438\u0434\u0438\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044e<\/h3>\n<p>\u041d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 DDL \u043e\u043f\u0430\u0441\u043d\u044b\u043c: \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441\u043e\u0442\u0435\u043d \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>PostgreSQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a. <code>ACCESS EXCLUSIVE<\/code> \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0435\u0436\u0438\u043c\u0430\u043c\u0438, \u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u0444\u043e\u0440\u043c\u044b <code>ALTER TABLE<\/code> \u043c\u043e\u0433\u0443\u0442 \u0431\u0440\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e. \u042d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 <code>ALTER TABLE<\/code> \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442 production. \u041d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c SQL \u0438 \u043d\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0435\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 staging, \u0430 \u0442\u0435\u043c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0441 \u043a\u0430\u043a\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u043e\u043c \u043e\u043d\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0441\u044f. <a href=\"https:\/\/www.postgresql.org\/docs\/current\/explicit-locking.html\" rel=\"noopener nofollow\">PostgreSQL: Explicit Locking<\/a><\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u0435\u043d \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c\u0430 DDL-\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0436\u0434\u0451\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. \u041f\u043e\u043a\u0430 \u043e\u043d\u0430 \u0436\u0434\u0451\u0442, \u0437\u0430 \u043d\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u0443\u0436\u0435 \u0441 \u0435\u0451 \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0435\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. \u0412\u043d\u0435\u0448\u043d\u0435 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e: \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u00ab\u0435\u0449\u0451 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0430\u00bb, \u0430 latency \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0440\u0430\u0441\u0442\u0451\u0442.<\/p>\n<p>Coding agent \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u043d\u0438\u043c\u043a\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u043d\u0430\u0435\u0442 PostgreSQL, \u0438\u0437 \u043a\u043e\u0434\u0430 \u043e\u043d \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 RPS \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0451;<\/p>\n<\/li>\n<li>\n<p>\u0435\u0441\u0442\u044c \u043b\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 deploy;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u043f\u0443\u043b\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u043a\u043e\u0439 replication lag \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c;<\/p>\n<\/li>\n<li>\n<p>\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 DDL.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.<\/p>\n<h3>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u0435\u043d \u0441\u0432\u043e\u0439 firewall<\/h3>\n<p>\u042f \u043d\u0430\u0437\u044b\u0432\u0430\u044e firewall \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 CI, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u2014 \u0430\u0433\u0435\u043d\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0430\u043c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0440\u0438\u0441\u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0434\u043e\u043f\u0443\u0441\u043a\u0435 \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0438 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u0445.<\/p>\n<p>\u042d\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b coding agents. OpenAI \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Codex \u0447\u0435\u0440\u0435\u0437 sandbox, approval policy, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0438\u0441\u043a\u043e\u043c. <a href=\"https:\/\/openai.com\/index\/running-codex-safely\/\" rel=\"noopener nofollow\">Running Codex safely at OpenAI<\/a><\/p>\n<p>\u0414\u043b\u044f \u0431\u0430\u0437\u044b \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 shell-\u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b.<\/p>\n<h3>\u0421\u043b\u043e\u0439 1. \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/h3>\n<p>\u0421\u0430\u043c\u044b\u0439 \u0434\u0435\u0448\u0451\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/p>\n<p>\u0414\u043b\u044f Django \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 <code>Migration.operations<\/code>. \u0414\u043b\u044f Alembic \u2014 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL \u0438\u043b\u0438 operation tree. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u043e\u043b\u0447\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c.<\/p>\n<pre><code class=\"python\">DANGEROUS = {    \"RunSQL\",    \"RemoveField\",    \"DeleteModel\",    \"AlterField\",}for operation in migration.operations:    if operation.__class__.__name__ in DANGEROUS:        fail(\"migration requires manual review\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435. <code>AlterField<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0438\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430. <code>RunSQL<\/code> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u044b\u0439 <code>COMMENT ON<\/code> \u0438\u043b\u0438 <code>UPDATE<\/code> \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u043e \u0434\u0430\u0436\u0435 \u0433\u0440\u0443\u0431\u044b\u0439 deny-list \u043f\u043e\u043b\u0435\u0437\u0435\u043d: \u043e\u043d \u043c\u0435\u043d\u044f\u0435\u0442 default \u0441 \u00ab\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u00bb \u043d\u0430 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u043f\u043e\u043a\u0430 \u0440\u0438\u0441\u043a \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u00bb.<\/p>\n<p>\u042f \u0431\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u0435\u0447\u0430\u043b \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>NOT NULL<\/code> \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, <code>RunSQL<\/code> \u0438 <code>RunPython<\/code>, \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 schema migration \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <code>atomic = False<\/code>.<\/p>\n<p>\u041d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e. \u041f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 diff \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0446\u0435\u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<h3>\u0421\u043b\u043e\u0439 2. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e migration file, \u043d\u043e \u0438 SQL<\/h3>\n<p>ORM \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 CI \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c SQL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0443\u0439\u0434\u0451\u0442 \u0432 \u0431\u0430\u0437\u0443.<\/p>\n<p>\u0414\u043b\u044f Django \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>sqlmigrate<\/code>:<\/p>\n<pre><code class=\"bash\">python manage.py sqlmigrate orders 0127<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 <code>AddField<\/code>, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 <code>ALTER TABLE<\/code>, <code>CREATE INDEX<\/code>, <code>DROP CONSTRAINT<\/code>.<\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 SQL \u043a\u0430\u043a \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 CI \u0440\u044f\u0434\u043e\u043c \u0441 risk report. \u0422\u043e\u0433\u0434\u0430 reviewer \u0432\u0438\u0434\u0438\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u0438 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 PostgreSQL.<\/p>\n<pre><code>CREATE INDEX                 -&gt; HIGHCREATE INDEX CONCURRENTLY    -&gt; MEDIUMDROP TABLE                   -&gt; BLOCKALTER TABLE ... TYPE         -&gt; HIGHADD CONSTRAINT ... NOT VALID -&gt; MEDIUMVALIDATE CONSTRAINT          -&gt; MEDIUM<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0423\u0440\u043e\u0432\u043d\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435. \u0412\u0430\u0436\u0435\u043d \u0441\u0430\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u00ab\u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0448\u0451\u043b\u00bb \u043a \u044f\u0432\u043d\u043e\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0438\u0441\u043a\u0430.<\/p>\n<h3>\u0421\u043b\u043e\u0439 3. \u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043f\u0438\u0438 \u0441\u0445\u0435\u043c\u044b<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439, \u043d\u043e \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0431\u0430\u0437\u044b.<\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u2014 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0432 CI \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 PostgreSQL, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c <code>migrate -&gt; rollback -&gt; migrate<\/code>, \u0435\u0441\u043b\u0438 rollback \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u041d\u043e \u043f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0431\u0440\u0430\u044f. \u0414\u043b\u044f data migration \u043f\u043e\u043b\u0435\u0437\u043d\u0435\u0435 shadow database \u0441 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u044a\u0451\u043c\u043e\u043c \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c production. \u0426\u0435\u043b\u044c \u2014 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0442\u0451\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439.<\/p>\n<pre><code class=\"python\">migrations.RunPython(fill_normalized_email)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0430 \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<pre><code class=\"python\">for user in User.objects.all():    user.normalized_email = user.email.lower()    user.save()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u0442\u044b\u0441\u044f\u0447\u0435 \u0441\u0442\u0440\u043e\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u041d\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u0445 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f, \u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f batch-\u0437\u0430\u0434\u0430\u0447\u0430 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 WAL, autovacuum, \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>Firewall \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u043e\u0432\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u00ab\u043e\u043f\u0430\u0441\u043d\u044b\u0439 SQL\u00bb, \u043d\u043e \u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.<\/p>\n<h3>\u0421\u043b\u043e\u0439 4. Expand \u2014 migrate \u2014 contract \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e one-shot<\/h3>\n<p>\u0410\u0433\u0435\u043d\u0442 \u043b\u044e\u0431\u0438\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0427\u0435\u043b\u043e\u0432\u0435\u043a \u0442\u043e\u0436\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e <code>RENAME COLUMN old TO new<\/code> \u0438 \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434.<\/p>\n<p>\u0414\u043b\u044f rolling deploy \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0435\u0449\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0430\u0441\u0442\u044c \u0443\u0436\u0435 \u0441 \u043d\u043e\u0432\u043e\u0439.<\/p>\n<pre><code>1. expand   \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c new_column2. deploy   \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u0435\u0438\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u04383. migrate   \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c new_column \u0431\u0430\u0442\u0447\u0430\u043c\u04384. deploy   \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0430 new_column5. contract   \u0443\u0434\u0430\u043b\u0438\u0442\u044c old_column \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u043c\u0435\u043d\u0435\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0432 diff, \u0437\u0430\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043a\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u0418 \u0437\u0434\u0435\u0441\u044c coding agent \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043b\u0435\u0437\u0435\u043d: \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0443\u043c\u0435\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c, dual-write, backfill command \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 cleanup. \u041d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043b\u0438\u0437\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u0421\u043b\u043e\u0439 5. lock_timeout \u0432\u0430\u0436\u043d\u0435\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0430\u0433\u0435\u043d\u0442\u0430<\/h3>\n<p>\u0414\u0430\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c production \u0432 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u0435.<\/p>\n<p>\u0414\u043b\u044f DDL \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 <code>lock_timeout<\/code>, \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0443\u043f\u0430\u043b\u0430, \u0430 \u043d\u0435 \u0436\u0434\u0430\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439.<\/p>\n<pre><code class=\"sql\">SET lock_timeout = '2s';ALTER TABLE orders ...;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0421\u043c\u044b\u0441\u043b \u0432 \u0434\u0440\u0443\u0433\u043e\u043c: \u043e\u0442\u043a\u0430\u0437 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435, \u0447\u0435\u043c \u043e\u0442\u043a\u0430\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u043b\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u0435\u043d \u0435\u0449\u0451 <code>statement_timeout<\/code>, \u043d\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0430 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. <code>lock_timeout<\/code> \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, <code>statement_timeout<\/code> \u2014 \u043e\u0431\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f statement. \u0418\u043d\u043e\u0433\u0434\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442, \u043d\u043e \u0436\u0434\u0430\u0442\u044c \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u2014 \u0443\u0436\u0435 \u043f\u043b\u043e\u0445\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b.<\/p>\n<h3>\u0410 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 NOT NULL \u0438 constraints<\/h3>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0430\u0433\u0435\u043d\u0442 \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u043b\u0435:<\/p>\n<pre><code class=\"python\">status = models.CharField(max_length=32, null=False)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <code>NULL<\/code>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 <code>NULL<\/code> \u043d\u0435\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u0430 \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<p>PostgreSQL \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a <code>NOT VALID<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>VALIDATE CONSTRAINT<\/code>. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u0442, \u0447\u0442\u043e <code>VALIDATE CONSTRAINT<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043c\u044f\u0433\u043a\u0438\u0439 <code>SHARE UPDATE EXCLUSIVE<\/code> lock. <a href=\"https:\/\/www.postgresql.org\/docs\/current\/sql-altertable.html\" rel=\"noopener nofollow\">PostgreSQL: ALTER TABLE<\/a><\/p>\n<p>Django \u0434\u043b\u044f PostgreSQL \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <code>AddConstraintNotValid<\/code> \u0438 <code>ValidateConstraint<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u044b. <a href=\"https:\/\/docs.djangoproject.com\/en\/6.0\/ref\/contrib\/postgres\/operations\/\" rel=\"noopener nofollow\">Django PostgreSQL migration operations<\/a><\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0432 \u043f\u0440\u043e\u043c\u043f\u0442 \u0430\u0433\u0435\u043d\u0442\u0443, \u0430 \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e policy \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041f\u0440\u043e\u043c\u043f\u0442 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u044b\u0442\u044c. CI \u2014 \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<h3>\u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 pipeline<\/h3>\n<p>\u042f \u0431\u044b \u043d\u0430\u0447\u0430\u043b \u0431\u0435\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0438 \u0431\u0435\u0437 LLM-reviewer \u0432 CI.<\/p>\n<pre><code class=\"yaml\">migration-check:  script:    - python manage.py makemigrations --check    - python tools\/check_migration_policy.py    - python manage.py sqlmigrate orders 0127 &gt; migration.sql    - python tools\/check_ddl.py migration.sql    - pytest tests\/migrations  artifacts:    paths:      - migration.sql      - migration-risk.json<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>migration-risk.json<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c:<\/p>\n<pre><code class=\"json\">{  \"risk\": \"high\",  \"reasons\": [    \"CREATE INDEX without CONCURRENTLY\",    \"table orders is in large-table allowlist\"  ],  \"requires_manual_approval\": true}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 policy \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438: \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446, \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u043e\u043a\u043d\u043e\u043c deploy, \u043d\u0430\u043b\u0438\u0447\u0438\u0435\u043c \u0440\u0435\u043f\u043b\u0438\u043a. \u041e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 <code>AddIndex<\/code> \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0437 20 \u0442\u044b\u0441\u044f\u0447 \u0441\u0442\u0440\u043e\u043a \u0438 \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0437 200 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0432\u0435\u0440\u0434\u0438\u043a\u0442.<\/p>\n<h3>\u0413\u0434\u0435 \u0437\u0434\u0435\u0441\u044c \u043c\u0435\u0441\u0442\u043e \u0441\u0430\u043c\u043e\u043c\u0443 AI<\/h3>\n<p>\u041f\u0430\u0440\u0430\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u043e, \u043d\u043e \u044f \u0431\u044b \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u0432\u0442\u043e\u0440\u043e\u0439 LLM \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0430\u0440\u0431\u0438\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0432\u043e\u0439.<\/p>\n<p>AI-review \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f: \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c expand\/contract, \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c <code>CONCURRENTLY<\/code>, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f reviewer. \u041d\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043b\u0443\u0447\u0448\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u044e\u0442 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043f\u0430\u0440\u0441\u0435\u0440\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, PostgreSQL, \u0442\u0435\u0441\u0442\u0430\u043c, \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c \u0438 policy engine.<\/p>\n<pre><code>AI:      \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u0440\u0438\u0441\u043aCI:      \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430DB:      \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 DDLhuman:   \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 production<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0430\u0433\u0435\u043d\u0442\u0430. \u041d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0442\u0430\u043a\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0431\u043e\u0434\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0437\u043e\u043d\u044b. \u0415\u0441\u043b\u0438 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 production \u0431\u0435\u0437 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0430\u0433\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0441\u043c\u0435\u043b\u0435\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0421\u0430\u043c\u0430\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u2014 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043b\u0438 \u0430\u0433\u0435\u043d\u0442 \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u044f \u0431\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043b\u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0438\u043d\u0443\u0442\u044b \u043d\u0430 <code>makemigrations<\/code>.<\/p>\n<p>\u041f\u043e\u043b\u0435\u0437\u043d\u0435\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435: \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 CI \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0434\u043e deploy, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 deploy \u0431\u044b\u043b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043d \u043f\u043e <code>lock_timeout<\/code>, \u0441\u043a\u043e\u043b\u044c\u043a\u043e schema changes \u043f\u0440\u043e\u0448\u043b\u0438 \u0431\u0435\u0437 \u0434\u0435\u0433\u0440\u0430\u0434\u0430\u0446\u0438\u0438 latency \u0438 replication lag.<\/p>\n<p>\u0423\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043b\u0435\u0433\u043a\u043e. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0436\u0438\u0432\u043e\u0439 \u0431\u0430\u0437\u0435, \u2014 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430.<\/p>\n<h3>\u0412\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0430<\/h3>\n<p>Coding agents \u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430, \u043d\u043e \u043d\u0435 \u0444\u0438\u0437\u0438\u043a\u0443 PostgreSQL. \u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043c\u044f\u0433\u0447\u0435 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e <code>ALTER TABLE<\/code> \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0430\u0433\u0435\u043d\u0442. \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0435\u043b\u0451\u043d\u043e\u0433\u043e unit-\u0442\u0435\u0441\u0442\u0430. \u0410 rolling deploy \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e diff \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u2014 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u0435\u0441\u0442\u0430, \u0433\u0434\u0435 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u0438\u044e \u0441\u0442\u043e\u0438\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u00ab\u0431\u0443\u0434\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u0435\u043d\u00bb, \u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0430\u0433\u0435\u043d\u0442 \u043f\u0438\u0448\u0435\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e. \u041f\u0443\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u041f\u0443\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 backfill \u0438 \u0442\u0435\u0441\u0442\u044b. \u041d\u043e \u043c\u0435\u0436\u0434\u0443 \u0435\u0433\u043e diff \u0438 production \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0442\u043e\u044f\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 DDL, \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0434\u0435\u0448\u0451\u0432\u043e\u0439, \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0441\u043c\u0435\u0441\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u0414\u043b\u044f \u0441\u0445\u0435\u043c\u044b \u0431\u0430\u0437\u044b \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e: \u043f\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f, \u0447\u0435\u043c \u043f\u044f\u0442\u044c\u0441\u043e\u0442.<\/p>\n<hr\/>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1084968\/\">https:\/\/habr.com\/ru\/articles\/1084968\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coding agent \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u043d\u044c\u0448\u0435 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u043b\u043e \u0441\u0432\u043e\u0435\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e: \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u043f\u043e\u043b\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440, \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0443\u043d\u043a\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u043e. ORM \u0441\u0430\u043c\u0430 \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c DDL, \u0430\u0433\u0435\u043d\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0437\u043d\u0430\u043a\u043e\u043c\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, diff \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u0435\u0441\u0442\u044b \u0437\u0435\u043b\u0451\u043d\u044b\u0435.\u041d\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u2014 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0432\u0438\u0434 \u043a\u043e\u0434\u0430. \u041e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043f\u044f\u0442\u0438 \u0441\u0442\u0440\u043e\u043a \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043c\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0439 blast radius, \u0447\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0442\u044b\u0441\u044f\u0447\u0443 \u0441\u0442\u0440\u043e\u043a \u0432 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0435. \u041e\u0448\u0438\u0431\u043a\u0430 \u0432 Python \u043e\u0431\u044b\u0447\u043d\u043e \u043b\u043e\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439 ALTER TABLE \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u043e \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u044a\u0435\u0441\u0442\u044c \u043f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u0445\u0435\u043c\u044b \u0432 \u043e\u0442\u043a\u0430\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.\u0421 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c coding agents \u044d\u0442\u0430 \u0430\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u044f \u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u0435\u0435. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0430 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b\u0430\u0441\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0430\u0433\u0435\u043d\u0442\u043e\u043c, \u043d\u0435 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 diff, \u0430 \u043a\u0430\u043a \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 Terraform, Kubernetes RBAC \u0438\u043b\u0438 CI-\u0441\u0435\u043a\u0440\u0435\u0442\u0430. \u0410\u0433\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c, \u043d\u043e \u043f\u0440\u0430\u0432\u043e \u043f\u0440\u043e\u0439\u0442\u0438 \u0432 production \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a.\u041f\u043e\u0447\u0435\u043c\u0443 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e code review \u0437\u0434\u0435\u0441\u044c \u043c\u0430\u043b\u043e\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 Django: \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430.class Order(models.Model):    provider_reference = models.CharField(max_length=128)\u0410\u0433\u0435\u043d\u0442 \u0432\u0438\u0434\u0438\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442:class Order(models.Model):    provider_reference = models.CharField(max_length=128, db_index=True)\u041f\u043e\u0441\u043b\u0435 makemigrations \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0439 AddIndex. \u041d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e. \u041d\u0430 production-\u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0446\u0435\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f.\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f PostgreSQL \u043f\u0440\u044f\u043c\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 CREATE INDEX \u0438 CREATE INDEX CONCURRENTLY: \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a CONCURRENTLY \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c INSERT, UPDATE \u0438 DELETE, \u0445\u043e\u0442\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. PostgreSQL: CREATE INDEX\u0412 Django \u0434\u043b\u044f PostgreSQL \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f AddIndexConcurrently. \u041e\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. \u041e\u043d\u0430 \u043c\u0435\u043d\u044f\u0435\u0442 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438.from django.contrib.postgres.operations import AddIndexConcurrentlyfrom django.db import migrations, modelsclass Migration(migrations.Migration):    atomic = False    operations = [        AddIndexConcurrently(            model_name=&#187;order&#187;,            index=models.Index(                fields=[&#171;provider_reference&#187;],                name=&#187;order_provider_ref_idx&#187;,            ),        ),    ]\u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c: CREATE INDEX CONCURRENTLY \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e transaction block. \u0422\u043e \u0435\u0441\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0438\u0441\u043a\u0430 \u0441\u0440\u0430\u0437\u0443 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0430\u043c\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u043e\u0439, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043f\u0440\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0438 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0451 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441 \u00ab\u0432\u0430\u043b\u0438\u0434\u0435\u043d \u043b\u0438 \u044d\u0442\u043e\u0442 Python-\u0444\u0430\u0439\u043b?\u00bb \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u041d\u0443\u0436\u0435\u043d \u0434\u0440\u0443\u0433\u043e\u0439: \u00ab\u0447\u0442\u043e \u044d\u0442\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0441 \u0436\u0438\u0432\u043e\u0439 \u0431\u0430\u0437\u043e\u0439, \u043f\u043e\u043a\u0430 \u0440\u044f\u0434\u043e\u043c \u0438\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b?\u00bb\u0410\u0433\u0435\u043d\u0442 \u0432\u0438\u0434\u0438\u0442 \u0441\u0445\u0435\u043c\u0443. Production \u0432\u0438\u0434\u0438\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044e\u041d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 DDL \u043e\u043f\u0430\u0441\u043d\u044b\u043c: \u0434\u043b\u0438\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0441\u043e\u0442\u0435\u043d \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438, \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438.PostgreSQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043e\u043a. ACCESS EXCLUSIVE \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u0435\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0435\u0436\u0438\u043c\u0430\u043c\u0438, \u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u0444\u043e\u0440\u043c\u044b ALTER TABLE \u043c\u043e\u0433\u0443\u0442 \u0431\u0440\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e. \u042d\u0442\u043e \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 ALTER TABLE \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442 production. \u041d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c SQL \u0438 \u043d\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0435\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 staging, \u0430 \u0442\u0435\u043c, \u0441 \u043a\u0430\u043a\u0438\u043c\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u043c\u0438 \u0438 \u0441 \u043a\u0430\u043a\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0442\u0440\u0430\u0444\u0438\u043a\u043e\u043c \u043e\u043d\u0430 \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0441\u044f. PostgreSQL: Explicit Locking\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u0435\u043d \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0441\u0430\u043c\u0430 DDL-\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0436\u0434\u0451\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. \u041f\u043e\u043a\u0430 \u043e\u043d\u0430 \u0436\u0434\u0451\u0442, \u0437\u0430 \u043d\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u0443\u044e\u0449\u0438\u0435 \u0443\u0436\u0435 \u0441 \u0435\u0451 \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0435\u0439 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439. \u0412\u043d\u0435\u0448\u043d\u0435 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e: \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u00ab\u0435\u0449\u0451 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0430\u00bb, \u0430 latency \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0440\u0430\u0441\u0442\u0451\u0442.Coding agent \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0441\u043d\u0438\u043c\u043a\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u043d\u0430\u0435\u0442 PostgreSQL, \u0438\u0437 \u043a\u043e\u0434\u0430 \u043e\u043d \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u0442:\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435;\u043a\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 RPS \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0451;\u0435\u0441\u0442\u044c \u043b\u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 deploy;\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u043f\u0443\u043b\u0435;\u043a\u0430\u043a\u043e\u0439 replication lag \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c;\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0431\u0435\u0437 \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u0439 \u0442\u044f\u0436\u0451\u043b\u043e\u0439 DDL.\u042d\u0442\u043e \u043d\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043d\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043d\u0443\u0436\u0435\u043d \u0441\u0432\u043e\u0439 firewall\u042f \u043d\u0430\u0437\u044b\u0432\u0430\u044e firewall \u043d\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 CI, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043a\u043e\u0434.\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u2014 \u0430\u0433\u0435\u043d\u0442 \u043d\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0430\u043c \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0440\u0438\u0441\u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0434\u043e\u043f\u0443\u0441\u043a\u0435 \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0438 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u0435\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u0445.\u042d\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b coding agents. OpenAI \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Codex \u0447\u0435\u0440\u0435\u0437 sandbox, approval policy, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u043c \u0440\u0438\u0441\u043a\u043e\u043c. Running Codex safely at OpenAI\u0414\u043b\u044f \u0431\u0430\u0437\u044b \u0442\u0430\u043a\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 shell-\u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0430 \u043a\u043b\u0430\u0441\u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b.\u0421\u043b\u043e\u0439 1. \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0421\u0430\u043c\u044b\u0439 \u0434\u0435\u0448\u0451\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430.\u0414\u043b\u044f Django \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 Migration.operations. \u0414\u043b\u044f Alembic \u2014 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 SQL \u0438\u043b\u0438 operation tree. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u043e\u043b\u0447\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c.DANGEROUS = {    &#171;RunSQL&#187;,    &#171;RemoveField&#187;,    &#171;DeleteModel&#187;,    &#171;AlterField&#187;,}for operation in migration.operations:    if operation.__class__.__name__ in DANGEROUS:        fail(&#171;migration requires manual review&#187;)\u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435. AlterField \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0438\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430. RunSQL \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u044b\u0439 COMMENT ON \u0438\u043b\u0438 UPDATE \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u043e \u0434\u0430\u0436\u0435 \u0433\u0440\u0443\u0431\u044b\u0439 deny-list \u043f\u043e\u043b\u0435\u0437\u0435\u043d: \u043e\u043d \u043c\u0435\u043d\u044f\u0435\u0442 default \u0441 \u00ab\u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u00bb \u043d\u0430 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c, \u043f\u043e\u043a\u0430 \u0440\u0438\u0441\u043a \u043d\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u00bb.\u042f \u0431\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u0435\u0447\u0430\u043b \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u0438 \u0442\u0430\u0431\u043b\u0438\u0446, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 NOT NULL \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, RunSQL \u0438 RunPython, \u043c\u0430\u0441\u0441\u043e\u0432\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 schema migration \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e atomic = False.\u041d\u0435 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043e. \u041f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 diff \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0446\u0435\u043d\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.\u0421\u043b\u043e\u0439 2. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e migration file, \u043d\u043e \u0438 SQLORM \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d\u0438 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 CI \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c SQL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0443\u0439\u0434\u0451\u0442 \u0432 \u0431\u0430\u0437\u0443.\u0414\u043b\u044f Django \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 sqlmigrate:python manage.py sqlmigrate orders 0127\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0443\u0436\u0435 \u043d\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 AddField, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 ALTER TABLE, CREATE INDEX, DROP CONSTRAINT.\u041f\u043e\u043b\u0435\u0437\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 SQL \u043a\u0430\u043a \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442 CI \u0440\u044f\u0434\u043e\u043c \u0441 risk report. \u0422\u043e\u0433\u0434\u0430 reviewer \u0432\u0438\u0434\u0438\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u0438 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 PostgreSQL.CREATE INDEX                 -&gt; HIGHCREATE INDEX CONCURRENTLY    -&gt; MEDIUMDROP TABLE                   -&gt; BLOCKALTER TABLE &#8230; TYPE         -&gt; HIGHADD CONSTRAINT &#8230; NOT VALID -&gt; MEDIUMVALIDATE CONSTRAINT          -&gt; MEDIUM\u0423\u0440\u043e\u0432\u043d\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435. \u0412\u0430\u0436\u0435\u043d \u0441\u0430\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043e\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u00ab\u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0448\u0451\u043b\u00bb \u043a \u044f\u0432\u043d\u043e\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0438\u0441\u043a\u0430.\u0421\u043b\u043e\u0439 3. \u041f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043f\u0438\u0438 \u0441\u0445\u0435\u043c\u044b\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439, \u043d\u043e \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0431\u0430\u0437\u044b.\u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u2014 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u0432 CI \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 PostgreSQL, \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c migrate -&gt; rollback -&gt; migrate, \u0435\u0441\u043b\u0438 rollback \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.\u041d\u043e \u043f\u0443\u0441\u0442\u0430\u044f \u0431\u0430\u0437\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0431\u0440\u0430\u044f. \u0414\u043b\u044f data migration \u043f\u043e\u043b\u0435\u0437\u043d\u0435\u0435 shadow database \u0441 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u044a\u0451\u043c\u043e\u043c \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c production. \u0426\u0435\u043b\u044c \u2014 \u043f\u043e\u0439\u043c\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0441\u0442\u0451\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439.migrations.RunPython(fill_normalized_email)\u0430 \u0432\u043d\u0443\u0442\u0440\u0438:for user in User.objects.all():    user.normalized_email = user.email.lower()    user.save()\u041d\u0430 \u0442\u044b\u0441\u044f\u0447\u0435 \u0441\u0442\u0440\u043e\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u041d\u0430 \u0434\u0435\u0441\u044f\u0442\u043a\u0430\u0445 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f, \u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f batch-\u0437\u0430\u0434\u0430\u0447\u0430 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043a \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043d\u0430 WAL, autovacuum, \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u0430\u0434\u0435\u043d\u0438\u044f.Firewall \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u043e\u0432\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u00ab\u043e\u043f\u0430\u0441\u043d\u044b\u0439 SQL\u00bb, \u043d\u043e \u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0430.\u0421\u043b\u043e\u0439 4. Expand \u2014 migrate \u2014 contract \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e one-shot\u0410\u0433\u0435\u043d\u0442 \u043b\u044e\u0431\u0438\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0427\u0435\u043b\u043e\u0432\u0435\u043a \u0442\u043e\u0436\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e RENAME COLUMN old TO new \u0438 \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0434.\u0414\u043b\u044f rolling deploy \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f: \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0435\u0449\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0441\u0442\u0430\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0430\u0441\u0442\u044c \u0443\u0436\u0435 \u0441 \u043d\u043e\u0432\u043e\u0439.1. expand   \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c new_column2. deploy   \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043e\u0431\u0435\u0438\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u04383. migrate   \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c new_column \u0431\u0430\u0442\u0447\u0430\u043c\u04384. deploy   \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0430 new_column5. contract   \u0443\u0434\u0430\u043b\u0438\u0442\u044c old_column \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u043b\u0438\u0437\u043e\u043c\u042d\u0442\u043e \u043c\u0435\u043d\u0435\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0432 diff, \u0437\u0430\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043a\u043b\u0430\u0434\u043a\u0438.\u0418 \u0437\u0434\u0435\u0441\u044c coding agent \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043b\u0435\u0437\u0435\u043d: \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0443\u043c\u0435\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0442\u044f\u043d\u0443\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c, dual-write, backfill command \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 cleanup. \u041d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043b\u0438\u0437\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.\u0421\u043b\u043e\u0439 5. lock_timeout \u0432\u0430\u0436\u043d\u0435\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0430\u0433\u0435\u043d\u0442\u0430\u0414\u0430\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c production \u0432 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0430\u043c\u043e\u0439 \u0431\u0430\u0437\u0435.\u0414\u043b\u044f DDL \u0440\u0430\u0437\u0443\u043c\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 lock_timeout, \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0443\u043f\u0430\u043b\u0430, \u0430 \u043d\u0435 \u0436\u0434\u0430\u043b\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439.SET lock_timeout = &#8216;2s&#8217;;ALTER TABLE orders &#8230;;\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0421\u043c\u044b\u0441\u043b \u0432 \u0434\u0440\u0443\u0433\u043e\u043c: \u043e\u0442\u043a\u0430\u0437 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435, \u0447\u0435\u043c \u043e\u0442\u043a\u0430\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430.\u0414\u043b\u044f \u0434\u043e\u043b\u0433\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u0435\u043d \u0435\u0449\u0451 statement_timeout, \u043d\u043e \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0432\u0430 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. lock_timeout \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438, statement_timeout \u2014 \u043e\u0431\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f statement. \u0418\u043d\u043e\u0433\u0434\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442, \u043d\u043e \u0436\u0434\u0430\u0442\u044c \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u0442&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-495512","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/495512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=495512"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/495512\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=495512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=495512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=495512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}