{"id":124,"date":"2014-11-06T13:41:58","date_gmt":"2014-11-06T08:41:58","guid":{"rendered":"http:\/\/developer.uz\/blog\/?p=124"},"modified":"2015-02-07T22:54:15","modified_gmt":"2015-02-07T17:54:15","slug":"migration-yii-2","status":"publish","type":"post","link":"https:\/\/developer.uz\/blog\/migration-yii-2\/","title":{"rendered":"\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 Yii-2"},"content":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432 Yii, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c <a href=\"http:\/\/developer.uz\/blog\/migrate-yii\/\" title=\"\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 Yii: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\" target=\"_blank\">\u043f\u0440\u043e\u0448\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431 \u043e\u0442\u043b\u0438\u0447\u0438\u044f\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 Yii2 \u043e\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 Yii1.x<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0432 protected, \u0430 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0417\u0430\u043f\u0443\u0441\u043a \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 yiic, \u0430 \u0447\u0435\u0440\u0435\u0437 yii: <\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">php yii migrate\/create add_table_pages<\/pre>\n<p>\u0424\u0430\u0439\u043b\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0435 console\/migrations<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"> php yiic migrate <\/pre>\n<p>\u0412 \u043e\u0431\u0449\u0438\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Schema \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<pre class=\"brush: plain; title: \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b:; notranslate\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b:\">\r\npublic function up()\r\n    {\r\n        $this-&gt;createTable('news', [\r\n            'id'     =&gt; 'pk',\r\n            'title'  =&gt; Schema::TYPE_STRING . ' NOT NULL',\r\n            'text'   =&gt; Schema::TYPE_TEXT . ' NOT NULL',\r\n            'date_create' =&gt; Schema::TYPE_DATETIME,\r\n            'thumb'  =&gt; Schema::TYPE_STRING\r\n        ]);\r\n    }\r\n<\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c <a href=\"https:\/\/github.com\/yiisoft\/yii2\/blob\/master\/docs\/guide\/db-migrations.md\" target=\"_blank\">\u0442\u0443\u0442<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0432 Yii, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0448\u043b\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431 \u043e\u0442\u043b\u0438\u0447\u0438\u044f\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 Yii2 \u043e\u0442 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0432 Yii1.x \u0417\u0430\u043f\u0443\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435 \u0432 protected, \u0430 \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0417\u0430\u043f\u0443\u0441\u043a \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 yiic, \u0430 \u0447\u0435\u0440\u0435\u0437 yii: \u0424\u0430\u0439\u043b\u044b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0435 console\/migrations \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[13],"_links":{"self":[{"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/posts\/124"}],"collection":[{"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":4,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":138,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions\/138"}],"wp:attachment":[{"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.uz\/blog\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}