Akelos チュートリアル 3

% ls -l booklink/app/installers/
total 16
-rw-r--r--   1 littlebuddha  littlebuddha  864  5  4 22:40 database_installer.php
-rw-r--r--   1 littlebuddha  littlebuddha  601  5  4 22:40 framework_installer.php
drwxr-xr-x   2 littlebuddha  littlebuddha   68  5  4 22:40 versions
% vi booklink/app/installers/database_installer.php

設定内容

設定内容に、adodb のカラム設定も記述してみる。

<?php
class BooklinkInstaller extends AkInstaller
{
    function up_1(){

        $this->createTable('books',
          'id,'.                  // the key
          'title C(32) NOTNULL,'. // the title of the book
          'description C(255),'.  // a description of the book
          'author_id,'.           // the author id. This is how Akelos will know how to link
          'published_on D'        // the publication date
       );

        $this->createTable('authors', 
          'id,'.               // the key
          'name C(64) NOTNULL' // the name of the author
          );
    }

    function down_1(){
        $this->dropTables('books','authors');
    }
}
?>
% ls -l app/installers/
total 24
-rwxr-xr-x   1 littlebuhha  littlebuhha  677  5  6 16:15 booklink_installer.php
-rwxr-xr-x   1 littlebuhha  littlebuhha  862  5  6 16:10 database_installer.php
-rwxr-xr-x   1 littlebuhha  littlebuhha  601  5  4 22:40 framework_installer.php
drwxr-xr-x   2 littlebuhha  littlebuhha   68  5  4 22:40 versions