-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drop setting table and use core setting helper instead
attempt to fix seeding issue code lemmings
- Loading branch information
Showing
39 changed files
with
246 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
src/database/migrations/2017_11_26_110800_update_settings_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Query\Expression; | ||
use Illuminate\Database\QueryException; | ||
|
||
class UpdateSettingsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
if (Schema::hasTable('calendar_settings')) { | ||
|
||
$settings = DB::table('calendar_settings')->first(); | ||
|
||
if (Schema::hasColumn('calendar_settings', 'slack_integration')) { | ||
setting([ | ||
'kassie.calendar.slack_integration', | ||
$settings->slack_integration, | ||
], true); | ||
} | ||
|
||
if (Schema::hasColumn('calendar_settings', 'slack_webhook')) { | ||
setting([ | ||
'kassie.calendar.slack_webhook', | ||
$settings->slack_webhook, | ||
], true); | ||
} | ||
|
||
if (Schema::hasColumn('calendar_settings', 'slack_emoji_importance_full')) { | ||
setting([ | ||
'kassie.calendar.slack_emoji_importance_full', | ||
$settings->slack_emoji_importance_full, | ||
], true); | ||
} | ||
|
||
if (Schema::hasColumn('calendar_settings', 'slack_emoji_importance_half')) { | ||
setting([ | ||
'kassie.calendar.slack_emoji_importance_half', | ||
$settings->slack_emoji_importance_half, | ||
], true); | ||
} | ||
|
||
if (Schema::hasColumn('calendar_settings', 'slack_emoji_importance_empty')) { | ||
setting([ | ||
'kassie.calendar.slack_emoji_importance_empty', | ||
$settings->slack_emoji_importance_empty, | ||
], true); | ||
} | ||
|
||
Schema::drop('calendar_settings'); | ||
|
||
} | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
if (!Schema::hasTable('calendar_settings')) { | ||
|
||
Schema::create('calendar_settings', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->boolean('slack_integration'); | ||
$table->string('slack_webhook'); | ||
$table->string('slack_emoji_importance_full'); | ||
$table->string('slack_emoji_importance_half'); | ||
$table->string('slack_emoji_importance_empty'); | ||
}); | ||
|
||
} | ||
|
||
if (!Schema::hasColumn('calendar_settings', 'slack_integration')) { | ||
Schema::table('calendar_settings', function(Blueprint $table) { | ||
$table->boolean('slack_integration')->first(); | ||
}); | ||
} | ||
|
||
if (!Schema::hasColumn('calendar_settings', 'slack_webhook')) { | ||
Schema::table('calendar_settings', function(Blueprint $table) { | ||
$table->string('slack_webhook')->after('slack_integration'); | ||
}); | ||
} | ||
|
||
if (!Schema::hasColumn('calendar_settings', 'slack_emoji_importance_full')) { | ||
Schema::table('calendar_settings', function(Blueprint $table) { | ||
$table->string('slack_emoji_importance_full')->after('slack_webhook'); | ||
}); | ||
} | ||
|
||
if (!Schema::hasColumn('calendar_settings', 'slack_emoji_importance_half')) { | ||
Schema::table('calendar_settings', function(Blueprint $table) { | ||
$table->string('slack_emoji_importance_half')->after('slack_emoji_importance_full'); | ||
}); | ||
} | ||
|
||
if (!Schema::hasColumn('calendar_settings', 'slack_emoji_importance_empty')) { | ||
Schema::table('calendar_settings', function(Blueprint $table) { | ||
$table->string('slack_emoji_importance_empty')->after('slack_emoji_importance_half'); | ||
}); | ||
} | ||
|
||
$settings['slack_integration'] = setting('kassie.calendar.slack_integration', true); | ||
if (is_null($settings['slack_integration'])) | ||
$settings['slack_integration'] = 0; | ||
|
||
$settings['slack_webhook'] = setting('kassie.calendar.slack_webhook', true); | ||
|
||
$settings['slack_emoji_importance_full'] = setting('kassie.calendar.slack_emoji_importance_full', true); | ||
|
||
$settings['slack_emoji_importance_half'] = setting('kassie.calendar.slack_emoji_importance_half', true); | ||
|
||
$settings['slack_emoji_importance_empty'] = setting('kassie.calendar.slack_emoji_importance_empty', true); | ||
|
||
DB::table('calendar_settings')->insert($settings); | ||
} | ||
} |
Oops, something went wrong.