Initial commit

This commit is contained in:
2026-07-05 21:52:31 +02:00
commit 93259f5b6d
35 changed files with 2389 additions and 0 deletions
@@ -0,0 +1,73 @@
<?php
namespace OCA\MoneyPlanner\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
class Version000002Date20260705000000 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('moneyplanner_transactions')) {
$table = $schema->createTable('moneyplanner_transactions');
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('user_id', 'string', [
'notnull' => true,
'length' => 64
]);
$table->addColumn('account_from', 'integer', [
'notnull' => false
]);
$table->addColumn('account_to', 'integer', [
'notnull' => false
]);
$table->addColumn('group', 'integer', [
'notnull' => true
]);
$table->addColumn('category', 'integer', [
'notnull' => true
]);
$table->addColumn('balance', 'decimal', [
'notnull' => true,
'length' => 65
]);
$table->addColumn('date', 'date', [
'notnull' => true
]);
$table->addColumn('freq_num', 'integer', [
'notnull' => false
]);
$table->addColumn('freq_type', 'string', [
'notnull' => true,
'length' => 1
]);
$table->setPrimaryKey(['id']);
$table->addIndex(['user_id'], 'moneyplanner_transactions_user_id_index');
} else {
$table = $schema->getTable('moneyplanner_transactions');
if ($table->hasIndex('moneyplanner_transactions_user_name_index')) {
$table->dropIndex('moneyplanner_transactions_user_name_index');
}
if ($table->hasColumn('name')) {
$table->dropColumn('name');
}
}
return $schema;
}
}