PageRenderTime 14ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 2class 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		
10		$sql = "create table board_cell (
11					id serial primary key, 
12					board_id int4 references board,
13					row_num int2 not null,
14					col_num int2 not null,
15					letter varchar(1) not null
16				)";
17		SqlAlterSchema($sql);
18		
19	}
20	
21	function down()
22	{
23		SqlAlterSchema("drop table board_cell");
24		SqlAlterSchema("drop table board");
25	}
26}