/apps/learn/migrations/00.00.01_words.php

http://zoop.googlecode.com/ · PHP · 27 lines · 25 code · 2 blank · 0 comment · 0 complexity · 26a20f0971a65d3250bf4a8beb945436 MD5 · raw file

  1. <?php
  2. class Migration_00_00_01 extends Migration
  3. {
  4. function up()
  5. {
  6. $sql = "create table word (
  7. id serial primary key,
  8. word text unique,
  9. len int2
  10. )";
  11. SqlAlterSchema($sql);
  12. $sql = "create table word_letter (
  13. id serial primary key,
  14. word_id int4 references word,
  15. letter \"char\",
  16. count int2
  17. )";
  18. SqlAlterSchema($sql);
  19. }
  20. function down()
  21. {
  22. SqlAlterSchema("drop table word_letter");
  23. SqlAlterSchema("drop table word");
  24. }
  25. }