{"id":337821,"date":"2022-09-02T09:00:26","date_gmt":"2022-09-02T09:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=337821"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=337821","title":{"rendered":"<span>\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u044f Laravel Nova \u0441 PostgreSQL \u043d\u0430 CockroachDB. \u041d\u0430\u0448 \u043e\u043f\u044b\u0442 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u043f\u0440\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0443\u044e, \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0448\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.<\/p>\n<p>\u041e \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/13e\/01c\/2cd\/13e01c2cde4c5eb46646e70b7ba3b3b4.jpg\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/13e\/01c\/2cd\/13e01c2cde4c5eb46646e70b7ba3b3b4.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c. \u0415\u0441\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442, backend \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Laravel (8.80.0 \u0432\u0435\u0440\u0441\u0438\u0438). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u2014 Laravel Nova (3.27.0 \u0432\u0435\u0440\u0441\u0438\u044f). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0421\u0423\u0411\u0414 \u2014 PostgreSQL. \u0420\u0430\u0437\u0432\u0435\u0440\u0442\u043a\u0430 \u0432 production \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Kubernetes. \u041e\u0434\u043d\u0430\u0436\u0434\u044b, \u0432 \u0441\u0438\u043b\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0447\u0438\u043d, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0441 PostgreSQL \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 CockroachDB. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u044b\u043b \u0443\u0441\u043f\u0435\u0448\u0435\u043d. <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f ORM \u043a CockroachDB. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 pgsql \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0421\u0423\u0411\u0414 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0430 \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Nova \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u0435 \u0441\u043e \u0441\u0432\u044f\u0437\u044c\u044e BelongsToManyField, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u043c benjacho\/belongs-to-many-field, \u043d\u043e \u043d\u0435 \u0441\u0443\u0442\u044c. \u0412 \u0430\u0434\u043c\u0438\u043d\u043a\u0435, \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0432\u044f\u0437\u0438, \u043f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043f\u0430\u0440\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e &#171;\u0441\u044b\u0440\u043e\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u043c\u0435\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434 782610923664375809, \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u043b\u043e\u0441\u044c JavaScript \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e 782610923664375800. \u0418 \u0434\u0430\u043b\u0435\u0435 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 &#171;violates foreign key constraint&#187; <\/p>\n<pre><code>local.ERROR: SQLSTATE[23503]: Foreign key violation: 7 ERROR:  insert on table \"******\" violates foreign key constraint \"********_id_foreign\" DETAIL:  Key (*****_id)=(782610923664375800) is not present in table \"******\". (SQL: insert into \"******\" (\"***_id\", \"***_id\") values (782611156327727105, 782610923664375800))  <\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u043d\u0435\u0439 \u043d\u0435 \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c. \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:   <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/fcf\/59f\/824\/fcf59f8248da35ff22431bd1ae5fb25e.jpg\" alt=\"&quot;\u0441\u044b\u0440\u043e\u0435&quot; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f\" title=\"&quot;\u0441\u044b\u0440\u043e\u0435&quot; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f\" width=\"1891\" height=\"931\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fcf\/59f\/824\/fcf59f8248da35ff22431bd1ae5fb25e.jpg\" data-blurred=\"true\"\/><figcaption>&#171;\u0441\u044b\u0440\u043e\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/900\/ffd\/c88\/900ffdc8894666071a2e62b460c1e739.jpg\" alt=\"\u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f\" title=\"\u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f\" width=\"1893\" height=\"930\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/900\/ffd\/c88\/900ffdc8894666071a2e62b460c1e739.jpg\" data-blurred=\"true\"\/><figcaption>\u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/figcaption><\/figure>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430<\/h3>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 JavaScript, \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u0438\u0440\u043e\u0434\u043e\u0439, \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 IEEE-754, \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u0430 <a href=\"https:\/\/stackoverflow.com\/questions\/21646800\/undesirable-long-number-rounding-in-chrome\">\u043f\u043e \u0441\u0435\u0431\u0435<\/a>. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0435\u0435 \u043e\u0431\u043e\u0439\u0442\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u043e \u043c\u044b \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432.<\/p>\n<blockquote>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f CockroachDB \u0441\u0442\u043e\u043b\u044c \u0432\u0435\u043b\u0438\u043a\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0435\u0451 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b?<\/p>\n<\/blockquote>\n<h3>\u0418 \u0442\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435<\/h3>\n<p>\u0423 CockroachDB \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043a\u0430\u043a INT. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u043d\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c Integer, BigInteger \u0435\u0441\u0442\u044c \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u0430\u043b\u0438\u0430\u0441\u044b \u043d\u0430 \u0432\u0441\u0435 \u0442\u043e\u0442 \u0436\u0435 \u0442\u0438\u043f INT, \u0438 \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0432\u043e\u0435\u0439 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435. <a href=\"https:\/\/www.cockroachlabs.com\/docs\/stable\/int.html#names-and-aliases\">\u0412\u043e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430<\/a> \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043f\u043e\u0434\u0432\u0435\u043b \u043d\u0430\u0441 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0443\u0442\u0435\u043c \u0441\u0442\u0440\u043e\u0433\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u043a unsignedInteger \u043f\u0440\u0438\u0432\u0435\u043b\u0430 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0432 \u0431\u0430\u0437\u0435 \u0432\u0441\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c int8. \u0422.\u0435. \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0438, \u043a \u0442\u043e\u043c\u0443 \u0438 \u043f\u0440\u0438\u0448\u043b\u0438.<\/p>\n<h3>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 CockroachDB<\/h3>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c CockroachDB \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b <a href=\"https:\/\/www.cockroachlabs.com\/docs\/stable\/int.html#considerations-for-64-bit-signed-integers\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0412\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0434\u0432\u0443\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c:    <\/p>\n<ol>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e default_int_size \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 4, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 Integer (int4) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u043f\u043e\u043b\u044f.   <\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c sql.defaults.default_int_size, \u043d\u043e \u0443\u0436\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430   <\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u043e\u0442\u0438\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430\u0448\u0438 DevOps \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u043d\u0435 \u043e\u0434\u043d\u0438 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0411\u0414.   <\/p>\n<p><strong>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 default_int_size \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (\u0441 \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438), \u0442\u043e CockroachDB \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0441 \u0442\u0438\u043f\u043e\u043c int8. \u0418 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438.<\/p>\n<h3>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>\u0412\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c uuid \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e \u043c\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u043b\u0438 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c 90% \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 uuid, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443. <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442: <\/p>\n<p><a href=\"https:\/\/ru.stackoverflow.com\/questions\/1146838\/%D0%A7%D1%82%D0%BE-%D0%BB%D1%83%D1%87%D1%88%D0%B5-%D0%B8-%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D0%B5%D0%B5-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D0%B2-%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%B5-%D0%BF%D0%B5%D1%80%D0%B2%D0%B8%D1%87%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BA%D0%BB%D1%8E%D1%87%D0%B0-%D0%B0%D0%B2%D1%82%D0%BE%D0%B8%D0%BD%D0%BA%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D1%82-%D0%B8\">\u0427\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430: \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0438\u043b\u0438 UUID?<\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/562936\/\">\u041f\u0440\u043e uuid-\u044b, \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/p>\n<p>\u0418\u0434\u0435\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043c\u044b \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u043b\u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u0442\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.cockroachlabs.com\/docs\/v22.1\/primary-key.html\">\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/a>.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0435 \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, CockroachDB \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e &#171;rowid&#187; \u043f\u043e\u043b\u044f (\u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 int8 \u0442\u0438\u043f\u043e\u043c).<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 rowid \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u043f\u043e\u043b\u0435 id, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043d\u0430\u043c unsignedInteger \u0442\u0438\u043f\u0430 (int4), \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 default_int_size. \u0418 \u0434\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435 id \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f ORM \u0432 \u0441\u0432\u044f\u0437\u044f\u0445 \u0442\u0430\u0431\u043b\u0438\u0446. \u0412\u0441\u044f \u0441\u0443\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438. <\/p>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 id \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e\u0442\u0441\u044f JavaScript \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u0430, \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u0430\u0432\u043e\u043a \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 ORM \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>\/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f id, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041a\u0430\u043a \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, CockroachDB \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 rowid \u043f\u043e\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 Schema::create('my_table', function (Blueprint $table) {                 $table->unsignedInteger('id');                 \/\/... });  Schema::table('my_table', function (Blueprint $table) {                 $table->unsignedInteger('id')->unique()->autoIncrement()->change(); });  \/\/ \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 down() \u043e\u0442\u043a\u0430\u0442\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0435 sequence \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 public function down()     {         Schema::dropIfExists('my_table');          \/\/ \u0414\u0440\u0430\u0439\u0432\u0435\u0440 'cockroach' - \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 config\/database \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 'pgsql', \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d         if (config('database.default') === 'cockroach') {             $pdo = DB::getPdo();             try {                 $pdo->query('drop sequence my_table_id_seq');             } catch (Exception $e) {                 Log::channel('stderr')->info('sequence my_table_id_seq not exist');             }         }     }   \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u043c\u043d\u043e\u0433\u0438\u0435-\u043a\u043e-\u043c\u043d\u043e\u0433\u0438\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043f\u043e\u043b\u0435\u043c BelongsToManyField \u0432 Nova Schema::create('my_table1_my_table2', function (Blueprint $table) {     \/\/ \u0417\u0434\u0435\u0441\u044c \u0442\u0438\u043f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d, \u0442.\u043a. \u043e\u043d \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0432\u044f\u0437\u0438                 $table->id();                  $table->unsignedInteger('my_table1_id')->nullable();                 $table->foreign('my_table1_id')->references('id')->on('my_table1')->onDelete('cascade');                  $table->unsignedInteger('my_table2_id')->nullable();                 $table->foreign('my_table2_id')->references('id')->on('my_table2')->onDelete('cascade'); }); <\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f PostgresConnector \u0447\u0435\u0440\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 default_int_size. \u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a CockroachDB \u0447\u0435\u0440\u0435\u0437 PostgeSQL \u0434\u0440\u0430\u0439\u0432\u0435\u0440.<\/p>\n<p>\u00a0\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">\/\/ app\/Database\/PostgresConnector &lt;?php  namespace App\\Database;  use Illuminate\\Database\\Connectors\\PostgresConnector as BaseConnector;  class PostgresConnector extends BaseConnector {     public function connect(array $config)     {         $pdo = parent::connect($config);          if (config('database.default') === 'cockroach') {             $pdo->query('set default_int_size = 4');         }         return $pdo;     } }  \/\/ app\/Providers\/DatabaseConnectorProvider &lt;?php  namespace App\\Providers;  use App\\Database\\PostgresConnector; use Illuminate\\Support\\ServiceProvider;  class DatabaseConnectorProvider extends ServiceProvider {     public function register()     {         $this->app->bind('db.connector.pgsql', PostgresConnector::class);     } }  \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432 config\/app 'providers' => [     \/\/...     App\\Providers\\DatabaseConnectorProvider::class, ], <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \ud83d\ude42<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/company\/sovcombank_technologies\/blog\/686006\/\"> https:\/\/habr.com\/ru\/company\/sovcombank_technologies\/blog\/686006\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0427\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u043f\u0440\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u044b\u044f\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0443\u044e, \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0448\u044c \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e.<\/p>\n<p>\u041e \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c. \u0415\u0441\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442, backend \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Laravel (8.80.0 \u0432\u0435\u0440\u0441\u0438\u0438). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u2014 Laravel Nova (3.27.0 \u0432\u0435\u0440\u0441\u0438\u044f). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0421\u0423\u0411\u0414 \u2014 PostgreSQL. \u0420\u0430\u0437\u0432\u0435\u0440\u0442\u043a\u0430 \u0432 production \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Kubernetes. \u041e\u0434\u043d\u0430\u0436\u0434\u044b, \u0432 \u0441\u0438\u043b\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0447\u0438\u043d, \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0441 PostgreSQL \u043d\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 CockroachDB. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0431\u044b\u043b \u0443\u0441\u043f\u0435\u0448\u0435\u043d. <\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f ORM \u043a CockroachDB. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 pgsql \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u0421\u0423\u0411\u0414 \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0430 \u043f\u0440\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 Nova \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u043b\u0435 \u0441\u043e \u0441\u0432\u044f\u0437\u044c\u044e BelongsToManyField, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u043c benjacho\/belongs-to-many-field, \u043d\u043e \u043d\u0435 \u0441\u0443\u0442\u044c. \u0412 \u0430\u0434\u043c\u0438\u043d\u043a\u0435, \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u043b\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0432\u044f\u0437\u0438, \u043f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043f\u0430\u0440\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e &#171;\u0441\u044b\u0440\u043e\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u043c\u0435\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u0438\u0434 782610923664375809, \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u043b\u043e\u0441\u044c JavaScript \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u043e\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e 782610923664375800. \u0418 \u0434\u0430\u043b\u0435\u0435 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 &#171;violates foreign key constraint&#187; <\/p>\n<pre><code>local.ERROR: SQLSTATE[23503]: Foreign key violation: 7 ERROR:  insert on table \"******\" violates foreign key constraint \"********_id_foreign\" DETAIL:  Key (*****_id)=(782610923664375800) is not present in table \"******\". (SQL: insert into \"******\" (\"***_id\", \"***_id\") values (782611156327727105, 782610923664375800))  <\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u043d\u0435\u0439 \u043d\u0435 \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c. \u0412 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:   <\/p>\n<figure class=\"full-width\"><figcaption>&#171;\u0441\u044b\u0440\u043e\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/figcaption><\/figure>\n<figure class=\"full-width\"><figcaption>\u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f<\/figcaption><\/figure>\n<h3>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430<\/h3>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 JavaScript, \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u0438\u0440\u043e\u0434\u043e\u0439, \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 IEEE-754, \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u0430 <a href=\"https:\/\/stackoverflow.com\/questions\/21646800\/undesirable-long-number-rounding-in-chrome\">\u043f\u043e \u0441\u0435\u0431\u0435<\/a>. \u0412\u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0435\u0435 \u043e\u0431\u043e\u0439\u0442\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u043d\u043e \u043c\u044b \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0432\u0435\u043d\u0434\u043e\u0440\u043e\u0432.<\/p>\n<blockquote>\n<p>\u0418\u0442\u0430\u043a, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u0430\u044f CockroachDB \u0441\u0442\u043e\u043b\u044c \u0432\u0435\u043b\u0438\u043a\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0435\u0451 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b?<\/p>\n<\/blockquote>\n<h3>\u0418 \u0442\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435<\/h3>\n<p>\u0423 CockroachDB \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043a\u0430\u043a INT. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u043d\u0430\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c Integer, BigInteger \u0435\u0441\u0442\u044c \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u0430\u043b\u0438\u0430\u0441\u044b \u043d\u0430 \u0432\u0441\u0435 \u0442\u043e\u0442 \u0436\u0435 \u0442\u0438\u043f INT, \u0438 \u043f\u043e \u0441\u0443\u0442\u0438 \u0441\u0432\u043e\u0435\u0439 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435. <a href=\"https:\/\/www.cockroachlabs.com\/docs\/stable\/int.html#names-and-aliases\">\u0412\u043e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430<\/a> \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0430\u043a\u0442 \u043f\u043e\u0434\u0432\u0435\u043b \u043d\u0430\u0441 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0443\u0442\u0435\u043c \u0441\u0442\u0440\u043e\u0433\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u043a unsignedInteger \u043f\u0440\u0438\u0432\u0435\u043b\u0430 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0432 \u0431\u0430\u0437\u0435 \u0432\u0441\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c int8. \u0422.\u0435. \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0438, \u043a \u0442\u043e\u043c\u0443 \u0438 \u043f\u0440\u0438\u0448\u043b\u0438.<\/p>\n<h3>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 CockroachDB<\/h3>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c CockroachDB \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b <a href=\"https:\/\/www.cockroachlabs.com\/docs\/stable\/int.html#considerations-for-64-bit-signed-integers\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0412\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0434\u0432\u0443\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c:    <\/p>\n<ol>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e default_int_size \u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 4, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 Integer (int4) \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u043f\u043e\u043b\u044f.   <\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c sql.defaults.default_int_size, \u043d\u043e \u0443\u0436\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430   <\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u043e\u0442\u0438\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043d\u0430\u0448\u0438 DevOps \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u043d\u0435 \u043e\u0434\u043d\u0438 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0411\u0414.   <\/p>\n<p><strong>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/strong> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 default_int_size \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 (\u0441 \u043f\u0440\u0438\u0441\u0443\u0449\u0438\u043c\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438), \u0442\u043e CockroachDB \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0441 \u0442\u0438\u043f\u043e\u043c int8. \u0418 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u043c\u044b \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438.<\/p>\n<h3>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>\u0412\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c uuid \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e. \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e \u043c\u044b \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u043b\u0438 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c 90% \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 uuid, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443. <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u0447\u0435\u0442: <\/p>\n<p><a href=\"https:\/\/ru.stackoverflow.com\/questions\/1146838\/%D0%A7%D1%82%D0%BE-%D0%BB%D1%83%D1%87%D1%88%D0%B5-%D0%B8-%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D0%B5%D0%B5-%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C-%D0%B2-%D0%BA%D0%B0%D1%87%D0%B5%D1%81%D1%82%D0%B2%D0%B5-%D0%BF%D0%B5%D1%80%D0%B2%D0%B8%D1%87%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BA%D0%BB%D1%8E%D1%87%D0%B0-%D0%B0%D0%B2%D1%82%D0%BE%D0%B8%D0%BD%D0%BA%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D1%82-%D0%B8\">\u0427\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430: \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0438\u043b\u0438 UUID?<\/a><\/p>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/562936\/\">\u041f\u0440\u043e uuid-\u044b, \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/p>\n<p>\u0418\u0434\u0435\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u0430 \u043c\u044b \u043f\u043e\u0447\u0435\u0440\u043f\u043d\u0443\u043b\u0438 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u0442\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438, \u0433\u0434\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.cockroachlabs.com\/docs\/v22.1\/primary-key.html\">\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430<\/a>.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0435 \u0431\u044b\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d, CockroachDB \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043a\u0440\u044b\u0442\u043e\u0433\u043e &#171;rowid&#187; \u043f\u043e\u043b\u044f (\u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 int8 \u0442\u0438\u043f\u043e\u043c).<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u044f\u0434\u0443 \u0441 rowid \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u043c \u043f\u043e\u043b\u0435 id, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u043d\u0430\u043c unsignedInteger \u0442\u0438\u043f\u0430 (int4), \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 default_int_size. \u0418 \u0434\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442 \u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u0435 id \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f ORM \u0432 \u0441\u0432\u044f\u0437\u044f\u0445 \u0442\u0430\u0431\u043b\u0438\u0446. \u0412\u0441\u044f \u0441\u0443\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438. <\/p>\n<p>\u0414\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0435, \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 id \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u044e\u0442\u0441\u044f JavaScript \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0444\u0440\u043e\u043d\u0442\u0430, \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u0430\u0432\u043e\u043a \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 ORM \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439:<\/p>\n<pre><code>\/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f id, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041a\u0430\u043a \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043b, \u0431\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, CockroachDB \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043a\u0440\u044b\u0442\u043e\u0435 rowid \u043f\u043e\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 Schema::create('my_table', function (Blueprint $table) {                 $table->unsignedInteger('id');                 \/\/... });  Schema::table('my_table', function (Blueprint $table) {                 $table->unsignedInteger('id')->unique()->autoIncrement()->change(); });  \/\/ \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 down() \u043e\u0442\u043a\u0430\u0442\u0430 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0435 sequence \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 public function down()     {         Schema::dropIfExists('my_table');          \/\/ \u0414\u0440\u0430\u0439\u0432\u0435\u0440 'cockroach' - \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 config\/database \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 'pgsql', \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d         if (config('database.default') === 'cockroach') {             $pdo = DB::getPdo();             try {                 $pdo->query('drop sequence my_table_id_seq');             } catch (Exception $e) {                 Log::channel('stderr')->info('sequence my_table_id_seq not exist');             }         }     }   \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 pivot \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u043c\u043d\u043e\u0433\u0438\u0435-\u043a\u043e-\u043c\u043d\u043e\u0433\u0438\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435 \u043f\u043e\u043b\u0435\u043c BelongsToManyField \u0432 Nova Schema::create('my_table1_my_table2', function (Blueprint $table) {     \/\/ \u0417\u0434\u0435\u0441\u044c \u0442\u0438\u043f \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u043d\u0435 \u0432\u0430\u0436\u0435\u043d, \u0442.\u043a. \u043e\u043d \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0432\u044f\u0437\u0438                 $table->id();                  $table->unsignedInteger('my_table1_id')->nullable();                 $table->foreign('my_table1_id')->references('id')->on('my_table1')->onDelete('cascade');                  $table->unsignedInteger('my_table2_id')->nullable();                 $table->foreign('my_table2_id')->references('id')->on('my_table2')->onDelete('cascade'); }); <\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f PostgresConnector \u0447\u0435\u0440\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 default_int_size. \u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a CockroachDB \u0447\u0435\u0440\u0435\u0437 PostgeSQL \u0434\u0440\u0430\u0439\u0432\u0435\u0440.<\/p>\n<p>\u00a0\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">\/\/ app\/Database\/PostgresConnector &lt;?php  namespace App\\Database;  use Illuminate\\Database\\Connectors\\PostgresConnector as BaseConnector;  class PostgresConnector extends BaseConnector {     public function connect(array $config)     {         $pdo = parent::connect($config);          if (config('database.default') === 'cockroach') {             $pdo->query('set default_int_size = 4');         }         return $pdo;     } }  \/\/ app\/Providers\/DatabaseConnectorProvider &lt;?php  namespace App\\Providers;  use App\\Database\\PostgresConnector; use Illuminate\\Support\\ServiceProvider;  class DatabaseConnectorProvider extends ServiceProvider {     public function register()     {         $this->app->bind('db.connector.pgsql', PostgresConnector::class);     } }  \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u0432 config\/app 'providers' => [     \/\/...     App\\Providers\\DatabaseConnectorProvider::class, ], <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u043c\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c, \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \ud83d\ude42<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/company\/sovcombank_technologies\/blog\/686006\/\"> https:\/\/habr.com\/ru\/company\/sovcombank_technologies\/blog\/686006\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-337821","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337821","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=337821"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337821\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}