function down() { $sql = "ALTER TABLE request DROP COLUMN status_id"; SqlAlterSchema($sql); $sql = "DROP TABLE status"; SqlAlterSchema($sql); }
function down() { $sql = "ALTER TABLE request DROP column priority_id"; SqlAlterSchema($sql); $sql = "DROP TABLE priority"; SqlAlterSchema($sql); }
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); }
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); } }
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); }
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()); } }
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); }
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); }
function down() { $sql = "DROP TABLE <tablename>"; SqlAlterSchema($sql, array()); }
function down() { SqlAlterSchema("drop table board_cell"); SqlAlterSchema("drop table board"); }
function down() { SqlAlterSchema("DROP TABLE session_data"); SqlAlterSchema("DROP TABLE session_base"); }
function down() { $sql = "DROP table attachment"; SqlAlterSchema($sql); }
function down() { SqlAlterSchema("drop index word_letter_word_id_idx"); }
function down() { $sql = "ALTER table request drop column short_desc"; SqlAlterSchema($sql); }
function down() { $sql = "DROP TABLE filter"; SqlAlterSchema($sql); }
function down() { SqlAlterSchema("drop table request"); SqlAlterSchema("drop table person"); }
function down() { $sql = "ALTER TABLE request RENAME COLUMN creator_id TO owner_id"; $sql = "DROP table comment"; SqlAlterSchema($sql); }
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); }
function down() { $sql = "DROP table token"; SqlAlterSchema($sql); }
function down() { SqlAlterSchema("drop table word_letter"); SqlAlterSchema("drop table word"); }