mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-18 05:58:18 +01:00
Account for differences between mysql and postgresql. Closes GH-89
This commit is contained in:
parent
f81e54e493
commit
593cb915ff
@ -14,7 +14,11 @@ class AlterTableIncidentsRemoveDefaultComponent extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('incidents', function (Blueprint $table) {
|
||||
DB::statement("ALTER TABLE incidents CHANGE component_id component_id TINYINT(4) NOT NULL DEFAULT '0';");
|
||||
if (Config::get('database')['default'] === 'mysql'){
|
||||
DB::statement("ALTER TABLE incidents CHANGE component_id component_id TINYINT(4) NOT NULL DEFAULT '0';");
|
||||
} else if (Config::get('database')['default'] === 'pgsql'){
|
||||
DB::statement("ALTER TABLE incidents ALTER COLUMN component_id SET DEFAULT '0';");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -22,11 +26,16 @@ class AlterTableIncidentsRemoveDefaultComponent extends Migration
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('incidents', function (Blueprint $table) {
|
||||
DB::statement("ALTER TABLE incidents CHANGE component_id component_id TINYINT(4) NOT NULL DEFAULT '1';");
|
||||
if (Config::get('database')['default'] === 'mysql'){
|
||||
DB::statement("ALTER TABLE incidents CHANGE component_id component_id TINYINT(4) NOT NULL DEFAULT '1';");
|
||||
} else if (Config::get('database')['default'] === 'pgsql'){
|
||||
DB::statement("ALTER TABLE incidents ALTER COLUMN component_id SET DEFAULT '1';");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user