/apps/learn/migrations/00.00.03_board.php

http://zoop.googlecode.com/ · PHP · 26 lines · 23 code · 3 blank · 0 comment · 0 complexity · 3d39df1d9555cbb97777c8177e9106cc MD5 · raw file

  1. <?php
  2. class Migration_00_00_03 extends Migration
  3. {
  4. function up()
  5. {
  6. $sql = "create table board (id serial primary key, name text unique)";
  7. SqlAlterSchema($sql);
  8. SqlInsertRow("insert into board (name) values (:name)", array('name' => 'default'));
  9. $sql = "create table board_cell (
  10. id serial primary key,
  11. board_id int4 references board,
  12. row_num int2 not null,
  13. col_num int2 not null,
  14. letter varchar(1) not null
  15. )";
  16. SqlAlterSchema($sql);
  17. }
  18. function down()
  19. {
  20. SqlAlterSchema("drop table board_cell");
  21. SqlAlterSchema("drop table board");
  22. }
  23. }