forked from pkp/pkp-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp#10571 Add migration to install process
- Loading branch information
1 parent
ff6ada5
commit e0ac04f
Showing
2 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
classes/migration/install/EmailTemplateUserGroupAccessMigration.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,46 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/migration/install/EmailTemplateUserGroupAccessMigration.php | ||
* | ||
* Copyright (c) 2014-2024 Simon Fraser University | ||
* Copyright (c) 2000-2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class HighlightsMigration | ||
* | ||
* @brief Describe database table structures for email template user group access | ||
*/ | ||
|
||
namespace PKP\migration\install; | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class EmailTemplateUserGroupAccessMigration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
$contextDao = \APP\core\Application::getContextDAO(); | ||
Schema::create('email_template_user_group_access', function (Blueprint $table) use ($contextDao) { | ||
$table->bigInteger('email_template_user_group_access_id')->autoIncrement()->comment('Primary key'); | ||
$table->string('email_key', 255)->comment("The email template's unique key"); | ||
$table->bigInteger('context_id')->comment('Identifier for the context for which the user group assignment occurs.'); | ||
$table->bigInteger('user_group_id')->nullable()->comment('The user group ID.'); | ||
|
||
$table->foreign('context_id')->references($contextDao->primaryKeyColumn)->on($contextDao->tableName)->onDelete('cascade')->onDelete('cascade'); | ||
$table->foreign('user_group_id')->references('user_group_id')->on('user_groups')->onDelete('cascade')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::drop('email_template_user_group_access'); | ||
} | ||
} |
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