Skip to content

Commit

Permalink
chore: update phinx migration files
Browse files Browse the repository at this point in the history
  • Loading branch information
webong committed Mar 2, 2023
1 parent 3bade71 commit 8a781c8
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 45 deletions.
Expand Up @@ -38,7 +38,7 @@ public function up()
}

// drop the pivot table
$this->dropTable('form_groups_form_attributes');
$this->table('form_groups_form_attributes')->drop()->save();
}

/**
Expand Down
Expand Up @@ -7,15 +7,15 @@ class RenameGroupsToStages extends AbstractMigration
public function up()
{
$this->table('form_groups')
->rename('form_stages');
->rename('form_stages')
->save();

$attributes = $this->table('form_attributes');
$attributes
$this->table('form_attributes')
->dropForeignKey('form_group_id')
->renameColumn('form_group_id', 'form_stage_id')
->update();
->save();

$attributes
$this->table('form_attributes')
->renameColumn('form_group_id', 'form_stage_id')
->addForeignKey('form_stage_id', 'form_stages', 'id', [
'delete' => 'CASCADE',
])
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/phinx/20150612013637_remove_tasks.php
Expand Up @@ -9,7 +9,7 @@ class RemoveTasks extends AbstractMigration
*/
public function up()
{
$this->dropTable('tasks');
$this->table('tasks')->drop()->save();
}

/**
Expand Down
Expand Up @@ -23,6 +23,6 @@ public function up()

public function down()
{
$this->dropTable('permissions');
$this->table('permissions')->drop()->save();
}
}
Expand Up @@ -30,6 +30,6 @@ public function up()
*/
public function down()
{
$this->dropTable('webhooks');
$this->table('webhooks')->drop()->save();
}
}
Expand Up @@ -25,6 +25,6 @@ public function up()
*/
public function down()
{
$this->dropTable('webhook_job');
$this->table('webhook_job')->drop()->save();
}
}
Expand Up @@ -32,6 +32,6 @@ public function up()
*/
public function down()
{
$this->dropTable('post_markdown');
$this->table('post_markdown')->save();
}
}
Expand Up @@ -24,6 +24,6 @@ public function up()
*/
public function down()
{
$this->dropTable('apikeys');
$this->table('apikeys')->drop()->save();
}
}
20 changes: 10 additions & 10 deletions database/migrations/phinx/20170419000000_drop_old_oauth_tables.php
Expand Up @@ -9,16 +9,16 @@ class DropOldOauthTables extends AbstractMigration
*/
public function up()
{
$this->dropTable('oauth_session_refresh_tokens');
$this->dropTable('oauth_session_token_scopes');
$this->dropTable('oauth_session_authcode_scopes');
$this->dropTable('oauth_session_access_tokens');
$this->dropTable('oauth_session_authcodes');
$this->dropTable('oauth_session_redirects');
$this->dropTable('oauth_sessions');
$this->dropTable('oauth_client_endpoints');
$this->dropTable('oauth_clients');
$this->dropTable('oauth_scopes');
$this->table('oauth_session_refresh_tokens')->drop()->save();
$this->table('oauth_session_token_scopes')->drop()->save();
$this->table('oauth_session_authcode_scopes')->drop()->save();
$this->table('oauth_session_access_tokens')->drop()->save();
$this->table('oauth_session_authcodes')->drop()->save();
$this->table('oauth_session_redirects')->drop()->save();
$this->table('oauth_sessions')->drop()->save();
$this->table('oauth_client_endpoints')->drop()->save();
$this->table('oauth_clients')->drop()->save();
$this->table('oauth_scopes')->drop()->save();
}

/**
Expand Down
Expand Up @@ -27,7 +27,7 @@ class DropFormsTagsTable extends AbstractMigration
*/
public function up()
{
$this->dropTable('forms_tags');
$this->table('forms_tags')->drop()->save();
}

public function down()
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/phinx/20170712152806_add_tos_table.php
Expand Up @@ -25,6 +25,6 @@ public function up()
*/
public function down()
{
$this->dropTable('tos');
$this->table('tos')->drop()->save();
}
}
Expand Up @@ -28,6 +28,6 @@ public function up()
*/
public function down()
{
$this->dropTable('post_locks');
$this->table('post_locks')->drop()->save();
}
}
Expand Up @@ -31,6 +31,6 @@ public function up()
*/
public function down()
{
$this->dropTable('export_job');
$this->table('export_job')->drop()->save();
}
}
Expand Up @@ -53,6 +53,6 @@ public function up()
*/
public function down()
{
$this->dropTable('country_codes');
$this->table('country_codes')->drop()->save();
}
}
Expand Up @@ -54,6 +54,6 @@ public function up()
*/
public function down()
{
$this->dropTable('targeted_survey_state');
$this->table('targeted_survey_state')->drop()->save();
}
}
Expand Up @@ -11,7 +11,7 @@ class ContactPostStateToTargetedSurvey extends AbstractMigration
*/
public function up()
{
$this->dropTable('targeted_survey_state');
$this->table('targeted_survey_state')->drop()->save();
$this->table('targeted_survey_state')
->addColumn('form_id', 'integer', ['null' => false])
->addColumn('post_id', 'integer', ['null' => false])
Expand Down Expand Up @@ -50,7 +50,7 @@ public function up()
*/
public function down()
{
$this->dropTable('targeted_survey_state');
$this->table('targeted_survey_state')->drop()->save();
$this->table('targeted_survey_state')
->addColumn('post_id', 'integer', ['null' => false])
->addColumn('contact_id', 'integer', ['null' => false])
Expand Down
Expand Up @@ -30,6 +30,6 @@ public function up()
*/
public function down()
{
$this->dropTable('hxl_license');
$this->table('hxl_license')->drop()->save();
}
}
Expand Up @@ -65,9 +65,9 @@ public function up()

public function down()
{
$this->dropTable('hxl_tag_attributes');
$this->dropTable('hxl_attribute_type_tag');
$this->dropTable('hxl_attributes');
$this->dropTable('hxl_tags');
$this->table('hxl_tag_attributes')->drop()->save();
$this->table('hxl_attribute_type_tag')->drop()->save();
$this->table('hxl_attributes')->drop()->save();
$this->table('hxl_tags')->drop()->save();
}
}
Expand Up @@ -38,6 +38,6 @@ public function up()
*/
public function down()
{
$this->dropTable('user_settings');
$this->table('user_settings')->drop()->save();
}
}
Expand Up @@ -55,6 +55,6 @@ public function up()

public function down()
{
$this->dropTable('hxl_meta_data');
$this->table('hxl_meta_data')->drop()->save();
}
}
Expand Up @@ -27,12 +27,12 @@ public function up()
->addForeignKey('hxl_attribute_id', 'hxl_attributes', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->addForeignKey('hxl_tag_id', 'hxl_tags', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->addForeignKey('export_job_id', 'export_job', 'id', ['delete'=>'CASCADE', 'update'=>'CASCADE'])
->setOptions(['comment' => 'The link between the form attributes and tags assigned to an export job.
This lets us set the hxl header correctly and search for the assigned values'])
// ->setOptions(['comment' => 'The link between the form attributes and tags assigned to an export job.
// This lets us set the hxl header correctly and search for the assigned values'])
->create();
}
public function down()
{
$this->dropTable('form_attribute_hxl_attribute_tag');
$this->table('form_attribute_hxl_attribute_tag')->drop()->save();
}
}
Expand Up @@ -18,6 +18,6 @@ public function up()
}
public function down()
{
$this->dropTable('translations');
$this->table('translations')->drop()->save();
}
}
@@ -1,5 +1,6 @@
<?php

use Illuminate\Support\Str;
use Phinx\Migration\AbstractMigration;

class AddLanguageToSurvey extends AbstractMigration
Expand All @@ -11,7 +12,7 @@ public function up()
"SELECT config_value FROM config WHERE group_name='site' and config_key='language' "
);
// get two letter lang code
$language = str_before(json_decode($result['config_value']), '-');
$language = Str::before(json_decode($result['config_value']), '-');
$this->table('forms')
->addColumn('base_language', 'string', ['null' => false, 'default' => $language]) //es/en
->update();
Expand Down
@@ -1,5 +1,6 @@
<?php

use Illuminate\Support\Str;
use Phinx\Migration\AbstractMigration;

class AddBaseLanguageToCategories extends AbstractMigration
Expand All @@ -11,7 +12,7 @@ public function up()
"SELECT config_value FROM config WHERE group_name='site' and config_key='language' "
);
// get two letter lang code
$language = str_before(json_decode($result['config_value']), '-');
$language = Str::before(json_decode($result['config_value']), '-');
$this->table('tags')
->addColumn('base_language', 'string', ['null' => false, 'default' => $language]) //es/en
->update();
Expand Down
@@ -1,5 +1,6 @@
<?php

use Illuminate\Support\Str;
use Phinx\Migration\AbstractMigration;

class AddBaseLanguageToPosts extends AbstractMigration
Expand All @@ -11,7 +12,7 @@ public function up()
"SELECT config_value FROM config WHERE group_name='site' and config_key='language' "
);
// get two letter lang code
$language = str_before(json_decode($result['config_value']), '-');
$language = Str::before(json_decode($result['config_value']), '-');
$this->table('posts')
->addColumn('base_language', 'string', ['null' => false, 'default' => $language]) //es/en
->update();
Expand Down

0 comments on commit 8a781c8

Please sign in to comment.