Skip to content

Commit ec18736

Browse files
authored
Merge pull request #221 from wmde/fee-change-migration
Add migration to create fee change table
2 parents 8449b0d + 8ac2c2a commit ec18736

File tree

5 files changed

+75
-2
lines changed

5 files changed

+75
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
"extra": {
5858
"branch-alias": {
59-
"dev-main": "7.0.x-dev"
59+
"dev-main": "8.2.x-dev"
6060
}
6161
},
6262
"config": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
3-
<entity name="WMDE\Fundraising\PaymentContext\Domain\Model\FeeChangePayment"/>
3+
<entity name="WMDE\Fundraising\PaymentContext\Domain\Model\FeeChangePayment" table="payment_fee_change"/>
44
</doctrine-mapping>

migrations-db.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
// This is the migration configuration for testing out the migrations
4+
5+
return [
6+
'dbname' => 'fundraising',
7+
'user' => 'fundraising',
8+
'password' => 'INSECURE PASSWORD',
9+
'host' => 'database',
10+
'driver' => 'pdo_mysql',
11+
];

migrations.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
// This is the migrations configuration file for developing migrations locally
4+
// DO NOT USE THIS IN PRODUCTION
5+
6+
return [
7+
'table_storage' => [
8+
'table_name' => 'doctrine_migration_versions',
9+
'version_column_name' => 'version',
10+
'version_column_length' => 1024,
11+
'executed_at_column_name' => 'executed_at',
12+
'execution_time_column_name' => 'execution_time',
13+
],
14+
15+
'migrations_paths' => [
16+
'WMDE\Fundraising\PaymentContext\DataAccess\Migrations' => './src/DataAccess/Migrations',
17+
],
18+
19+
'all_or_nothing' => true,
20+
'organize_migrations' => 'none',
21+
'connection' => null,
22+
'em' => null,
23+
];
24+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare( strict_types=1 );
4+
5+
namespace WMDE\Fundraising\PaymentContext\DataAccess\Migrations;
6+
7+
use Doctrine\DBAL\Schema\PrimaryKeyConstraint;
8+
use Doctrine\DBAL\Schema\Schema;
9+
use Doctrine\DBAL\Types\Types;
10+
use Doctrine\Migrations\AbstractMigration;
11+
12+
final class Version20250916164428 extends AbstractMigration {
13+
private const string TABLE_NAME = 'payment_fee_change';
14+
15+
public function getDescription(): string {
16+
return 'Create FeeChange payment table';
17+
}
18+
19+
public function up( Schema $schema ): void {
20+
$feeChange = $schema->createTable( self::TABLE_NAME );
21+
$feeChange->addColumn( 'id', Types::INTEGER );
22+
$feeChange->addPrimaryKeyConstraint( PrimaryKeyConstraint::editor()
23+
->setUnquotedColumnNames( 'id' )
24+
->create()
25+
);
26+
$feeChange->addForeignKeyConstraint(
27+
'payment',
28+
[ 'id' ],
29+
[ 'id' ],
30+
[ 'onDelete' => 'CASCADE' ],
31+
'FK_A072317DBF396750'
32+
);
33+
}
34+
35+
public function down( Schema $schema ): void {
36+
$schema->dropTable( self::TABLE_NAME );
37+
}
38+
}

0 commit comments

Comments
 (0)