官术网_书友最值得收藏!

Creating the database

To create the database, we again use migrations. From the command line, let's navigate to the project root and create the migration using yiic:

$ php protected/yiic.php migrate create locations

After confirming the creation, we open up the new migration file in protected/migrations and replace the contents up() method with the following:

return $this->createTable('locations', array(
   'id' => 'INTEGER PRIMARY KEY',
   'name' => 'TEXT',
   'lat' => 'TEXT',
   'long' => 'TEXT',
   'city' => 'TEXT',
   'state' => 'TEXT',
   'created' => 'INTEGER',
   'updated' => 'INTEGER'
));

Then, we replace the contents of the down() method with the following:

return $this->dropTable('locations');

From the command line, let's now apply the new migration:

$ php protected/yiic.php migrate up
主站蜘蛛池模板: 三亚市| 鹿泉市| 建瓯市| 清镇市| 房产| 柘荣县| 大悟县| 盐亭县| 阜城县| 张掖市| 通海县| 女性| 金坛市| 天津市| 马鞍山市| 永年县| 白河县| 巧家县| 曲松县| 三穗县| 潮安县| 九台市| 都江堰市| 贵阳市| 拜泉县| 鄂温| 柳河县| 永仁县| 都匀市| 呼图壁县| 太白县| 松江区| 平和县| 衡阳县| 昌宁县| 高淳县| 谢通门县| 阿拉善右旗| 师宗县| 大兴区| 郎溪县|