Example #1
0
 function down()
 {
     $sql = "ALTER TABLE request DROP COLUMN status_id";
     SqlAlterSchema($sql);
     $sql = "DROP TABLE status";
     SqlAlterSchema($sql);
 }
Example #2
0
 function down()
 {
     $sql = "ALTER TABLE request DROP column priority_id";
     SqlAlterSchema($sql);
     $sql = "DROP TABLE priority";
     SqlAlterSchema($sql);
 }
Example #3
0
 function up()
 {
     $sql = "create table person (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tfirstname text,\n\t\t\t\t\tlastname text,\n\t\t\t\t\tusername text,\n\t\t\t\t\tpassword text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table project (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tname text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table entry (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tperson_id int4 references person,\n\t\t\t\t\tproject_id int4 references project,\n\t\t\t\t\tstarttime timestamp with time zone not null,\n\t\t\t\t\tendtime timestamp with time zone\n\t\t\t\t)";
     SqlAlterSchema($sql);
 }
Example #4
0
 static function initDb()
 {
     //	create the migration table if it does not exist
     $schema = SqlGetSchema();
     if (!$schema->tableExists('migration')) {
         $sql = "create table migration (\n\t\t\t\t\t\tid serial primary key, \n\t\t\t\t\t\tname text not null,\n\t\t\t\t\t\tapplied int2 not null default 0)";
         SqlAlterSchema($sql);
     }
 }
Example #5
0
 function up()
 {
     $sql = "create table client\n\t\t\t\t(\n\t\t\t\t\tid serial primary key,\n\t\t\t\t\tname text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table invoice\n\t\t\t\t(\n\t\t\t\t\tid serial primary key,\n\t\t\t\t\tclient_id int4 references client\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table invoice_item\n\t\t\t\t(\n\t\t\t\t\tid serial primary key,\n\t\t\t\t\tinvoice_id int4 references invoice\n\t\t\t\t)";
     SqlAlterSchema($sql);
 }
Example #6
0
 static function initDb($type)
 {
     if ($type != 'migration' && $type != 'seed') {
         trigger_error("invalid migration type: {$type}");
     }
     //	create the migration table if it does not exist
     $schema = SqlGetSchema();
     if (!$schema->tableExists($type)) {
         $sql = "create table {$type} (\n\t\t\t\t\t\tid serial primary key, \n\t\t\t\t\t\tname text not null,\n\t\t\t\t\t\tapplied int2 not null default 0)";
         SqlAlterSchema($sql, array());
     }
 }
Example #7
0
 function up()
 {
     $sql = "create table person (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tfirstname text,\n\t\t\t\t\tlastname text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table exercise (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tshort text,\n\t\t\t\t\tlong text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table session (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tperson_id int4 references person(id),\n\t\t\t\t\tdate timestamp with time zone\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table unit (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tname text\n\t\t\t\t)";
     SqlAlterSchema($sql);
     $sql = "create table session_exercise (\n\t\t\t\t\tid serial primary key, \n\t\t\t\t\tsession_id int4 references session(id),\n\t\t\t\t\texercise_id int4 references exercise(id),\n\t\t\t\t\tunit_id int4 references unit(id),\n\t\t\t\t\tunit_count int4 not null default 0\n\t\t\t\t)";
     SqlAlterSchema($sql);
 }
Example #8
0
 function down()
 {
     // $sql = "ALTER table request drop column html_desc";
     // SqlAlterSchema($sql);
     //
     // $sql = "ALTER table request drop column text_desc";
     // SqlAlterSchema($sql);
     //
     // $sql = "ALTER table request drop column description";
     // SqlAlterSchema($sql);
     //
     $sql = "ALTER table request drop column message_id";
     SqlAlterSchema($sql);
 }
Example #9
0
 function down()
 {
     $sql = "DROP TABLE <tablename>";
     SqlAlterSchema($sql, array());
 }
Example #10
0
 function down()
 {
     SqlAlterSchema("drop table board_cell");
     SqlAlterSchema("drop table board");
 }
Example #11
0
 function down()
 {
     SqlAlterSchema("DROP TABLE session_data");
     SqlAlterSchema("DROP TABLE session_base");
 }
Example #12
0
 function down()
 {
     $sql = "DROP table attachment";
     SqlAlterSchema($sql);
 }
Example #13
0
 function down()
 {
     SqlAlterSchema("drop index word_letter_word_id_idx");
 }
Example #14
0
 function down()
 {
     $sql = "ALTER table request drop column short_desc";
     SqlAlterSchema($sql);
 }
Example #15
0
 function down()
 {
     $sql = "DROP TABLE filter";
     SqlAlterSchema($sql);
 }
Example #16
0
 function down()
 {
     SqlAlterSchema("drop table request");
     SqlAlterSchema("drop table person");
 }
Example #17
0
 function down()
 {
     $sql = "ALTER TABLE request RENAME COLUMN creator_id TO owner_id";
     $sql = "DROP table comment";
     SqlAlterSchema($sql);
 }
Example #18
0
 function up()
 {
     $sql = "CREATE TABLE session_form\n\t\t\t\t(\n\t\t\t\t    id serial primary key,\n\t\t\t\t    session_id text not null,\n\t\t\t\t    fields text not null\n\t\t\t\t)";
     SqlAlterSchema($sql);
 }
Example #19
0
 function down()
 {
     $sql = "DROP table token";
     SqlAlterSchema($sql);
 }
Example #20
0
 function down()
 {
     SqlAlterSchema("drop table word_letter");
     SqlAlterSchema("drop table word");
 }