Skip to content

Commit 7afdebd

Browse files
committed
Fix package setup issue
1 parent 7e9bfc5 commit 7afdebd

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

packages/emoji/setup/.gitkeep

Whitespace-only changes.

packages/emoji/setup/Emoji.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/**
4+
* @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5+
* @copyright Aimeos (aimeos.org), 2021-2023
6+
*/
7+
8+
9+
namespace Aimeos\Upscheme\Task;
10+
11+
12+
class Emoji extends Base
13+
{
14+
public function up()
15+
{
16+
$this->info( 'Creating emoji schema', 'vv' );
17+
$db = $this->db( 'db-emoji' );
18+
19+
foreach( $this->paths( 'default/schema/emoji.php' ) as $filepath )
20+
{
21+
if( ( $list = include( $filepath ) ) === false ) {
22+
throw new \RuntimeException( sprintf( 'Unable to get schema from file "%1$s"', $filepath ) );
23+
}
24+
25+
foreach( $list['table'] ?? [] as $name => $fcn ) {
26+
$db->table( $name, $fcn );
27+
}
28+
}
29+
}
30+
}

packages/emoji/setup/schema/emoji.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5+
* @copyright Aimeos (aimeos.org), 2016-2023
6+
*/
7+
8+
9+
return array(
10+
'table' => array(
11+
12+
'mshop_emoji' => function( \Aimeos\Upscheme\Schema\Table $table ) {
13+
$table->engine = 'InnoDB';
14+
$table->id();
15+
$table->string( 'code' );
16+
$table->string( 'label' )->default( '' );
17+
$table->smallInteger( 'status' )->default( 1 );
18+
$table->index( ['status', 'code'], 'idx_msemoj_load' );
19+
},
20+
21+
'mshop_emoji_user_product_relation' => function( \Aimeos\Upscheme\Schema\Table $table ) {
22+
$table->engine = 'InnoDB';
23+
$table->id();
24+
$table->string( 'product_id' );
25+
$table->integer( 'user_id' );
26+
$table->integer( 'emoji_id' );
27+
},
28+
)
29+
);

0 commit comments

Comments
 (0)