mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch errors in database table create statements.
This commit is contained in:
parent
40e2bf7cac
commit
dd11f98be7
12
.ci/php-cs-fixer/composer.lock
generated
12
.ci/php-cs-fixer/composer.lock
generated
@ -379,16 +379,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "friendsofphp/php-cs-fixer",
|
"name": "friendsofphp/php-cs-fixer",
|
||||||
"version": "v3.15.1",
|
"version": "v3.16.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
|
||||||
"reference": "d48755372a113bddb99f749e34805d83f3acfe04"
|
"reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d48755372a113bddb99f749e34805d83f3acfe04",
|
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d40f9436e1c448d309fa995ab9c14c5c7a96f2dc",
|
||||||
"reference": "d48755372a113bddb99f749e34805d83f3acfe04",
|
"reference": "d40f9436e1c448d309fa995ab9c14c5c7a96f2dc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -463,7 +463,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
|
||||||
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.15.1"
|
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.16.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -471,7 +471,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2023-03-13T23:26:30+00:00"
|
"time": "2023-04-02T19:30:06+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/cache",
|
"name": "psr/cache",
|
||||||
|
@ -78,7 +78,7 @@ class NetWorth implements NetWorthInterface
|
|||||||
|
|
||||||
$netWorth = [];
|
$netWorth = [];
|
||||||
$result = [];
|
$result = [];
|
||||||
// Log::debug(sprintf('Now in getNetWorthByCurrency(%s)', $date->format('Y-m-d')));
|
// Log::debug(sprintf('Now in getNetWorthByCurrency(%s)', $date->format('Y-m-d')));
|
||||||
|
|
||||||
// get default currency
|
// get default currency
|
||||||
$default = app('amount')->getDefaultCurrencyByUser($this->user);
|
$default = app('amount')->getDefaultCurrencyByUser($this->user);
|
||||||
@ -89,11 +89,11 @@ class NetWorth implements NetWorthInterface
|
|||||||
// get the preferred currency for this account
|
// get the preferred currency for this account
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
// Log::debug(sprintf('Now at account #%d: "%s"', $account->id, $account->name));
|
// Log::debug(sprintf('Now at account #%d: "%s"', $account->id, $account->name));
|
||||||
$currencyId = (int)$this->accountRepository->getMetaValue($account, 'currency_id');
|
$currencyId = (int)$this->accountRepository->getMetaValue($account, 'currency_id');
|
||||||
$currencyId = 0 === $currencyId ? $default->id : $currencyId;
|
$currencyId = 0 === $currencyId ? $default->id : $currencyId;
|
||||||
|
|
||||||
// Log::debug(sprintf('Currency ID is #%d', $currencyId));
|
// Log::debug(sprintf('Currency ID is #%d', $currencyId));
|
||||||
|
|
||||||
// balance in array:
|
// balance in array:
|
||||||
$balance = $balances[$account->id] ?? '0';
|
$balance = $balances[$account->id] ?? '0';
|
||||||
@ -106,13 +106,13 @@ class NetWorth implements NetWorthInterface
|
|||||||
$balance = bcsub($balance, $virtualBalance);
|
$balance = bcsub($balance, $virtualBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log::debug(sprintf('Balance corrected to %s because of virtual balance (%s)', $balance, $virtualBalance));
|
// Log::debug(sprintf('Balance corrected to %s because of virtual balance (%s)', $balance, $virtualBalance));
|
||||||
|
|
||||||
if (!array_key_exists($currencyId, $netWorth)) {
|
if (!array_key_exists($currencyId, $netWorth)) {
|
||||||
$netWorth[$currencyId] = '0';
|
$netWorth[$currencyId] = '0';
|
||||||
}
|
}
|
||||||
$netWorth[$currencyId] = bcadd($balance, $netWorth[$currencyId]);
|
$netWorth[$currencyId] = bcadd($balance, $netWorth[$currencyId]);
|
||||||
// Log::debug(sprintf('Total net worth for currency #%d is %s', $currencyId, $netWorth[$currencyId]));
|
// Log::debug(sprintf('Total net worth for currency #%d is %s', $currencyId, $netWorth[$currencyId]));
|
||||||
}
|
}
|
||||||
ksort($netWorth);
|
ksort($netWorth);
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
Log::info(sprintf('Ignore search operator "%s"', $operator));
|
Log::info(sprintf('Ignore search operator "%s"', $operator));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
//
|
//
|
||||||
// all account related searches:
|
// all account related searches:
|
||||||
//
|
//
|
||||||
case 'account_is':
|
case 'account_is':
|
||||||
$this->searchAccount($value, 3, 4);
|
$this->searchAccount($value, 3, 4);
|
||||||
break;
|
break;
|
||||||
@ -496,9 +496,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->findNothing();
|
$this->collector->findNothing();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// cash account
|
// cash account
|
||||||
//
|
//
|
||||||
case 'source_is_cash':
|
case 'source_is_cash':
|
||||||
$account = $this->getCashAccount();
|
$account = $this->getCashAccount();
|
||||||
$this->collector->setSourceAccounts(new Collection([$account]));
|
$this->collector->setSourceAccounts(new Collection([$account]));
|
||||||
@ -523,9 +523,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$account = $this->getCashAccount();
|
$account = $this->getCashAccount();
|
||||||
$this->collector->excludeAccounts(new Collection([$account]));
|
$this->collector->excludeAccounts(new Collection([$account]));
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// description
|
// description
|
||||||
//
|
//
|
||||||
case 'description_starts':
|
case 'description_starts':
|
||||||
$this->collector->descriptionStarts([$value]);
|
$this->collector->descriptionStarts([$value]);
|
||||||
break;
|
break;
|
||||||
@ -552,9 +552,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
case '-description_is':
|
case '-description_is':
|
||||||
$this->collector->descriptionIsNot($value);
|
$this->collector->descriptionIsNot($value);
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// currency
|
// currency
|
||||||
//
|
//
|
||||||
case 'currency_is':
|
case 'currency_is':
|
||||||
$currency = $this->findCurrency($value);
|
$currency = $this->findCurrency($value);
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
@ -591,9 +591,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->findNothing();
|
$this->collector->findNothing();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// attachments
|
// attachments
|
||||||
//
|
//
|
||||||
case 'has_attachments':
|
case 'has_attachments':
|
||||||
case '-has_no_attachments':
|
case '-has_no_attachments':
|
||||||
Log::debug('Set collector to filter on attachments.');
|
Log::debug('Set collector to filter on attachments.');
|
||||||
@ -604,7 +604,7 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
Log::debug('Set collector to filter on NO attachments.');
|
Log::debug('Set collector to filter on NO attachments.');
|
||||||
$this->collector->hasNoAttachments();
|
$this->collector->hasNoAttachments();
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// categories
|
// categories
|
||||||
case '-has_any_category':
|
case '-has_any_category':
|
||||||
case 'has_no_category':
|
case 'has_no_category':
|
||||||
@ -683,9 +683,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->findNothing();
|
$this->collector->findNothing();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// budgets
|
// budgets
|
||||||
//
|
//
|
||||||
case '-has_any_budget':
|
case '-has_any_budget':
|
||||||
case 'has_no_budget':
|
case 'has_no_budget':
|
||||||
$this->collector->withoutBudget();
|
$this->collector->withoutBudget();
|
||||||
@ -764,9 +764,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->findNothing();
|
$this->collector->findNothing();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// bill
|
// bill
|
||||||
//
|
//
|
||||||
case '-has_any_bill':
|
case '-has_any_bill':
|
||||||
case 'has_no_bill':
|
case 'has_no_bill':
|
||||||
$this->collector->withoutBill();
|
$this->collector->withoutBill();
|
||||||
@ -843,9 +843,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->findNothing();
|
$this->collector->findNothing();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// tags
|
// tags
|
||||||
//
|
//
|
||||||
case '-has_any_tag':
|
case '-has_any_tag':
|
||||||
case 'has_no_tag':
|
case 'has_no_tag':
|
||||||
$this->collector->withoutTags();
|
$this->collector->withoutTags();
|
||||||
@ -873,9 +873,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->setWithoutSpecificTags($result);
|
$this->collector->setWithoutSpecificTags($result);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// notes
|
// notes
|
||||||
//
|
//
|
||||||
case 'notes_contains':
|
case 'notes_contains':
|
||||||
$this->collector->notesContain($value);
|
$this->collector->notesContain($value);
|
||||||
break;
|
break;
|
||||||
@ -914,9 +914,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
case '-reconciled':
|
case '-reconciled':
|
||||||
$this->collector->isNotReconciled();
|
$this->collector->isNotReconciled();
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// amount
|
// amount
|
||||||
//
|
//
|
||||||
case 'amount_is':
|
case 'amount_is':
|
||||||
// strip comma's, make dots.
|
// strip comma's, make dots.
|
||||||
Log::debug(sprintf('Original value "%s"', $value));
|
Log::debug(sprintf('Original value "%s"', $value));
|
||||||
@ -987,9 +987,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
|
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
|
||||||
$this->collector->foreignAmountMore($amount);
|
$this->collector->foreignAmountMore($amount);
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// transaction type
|
// transaction type
|
||||||
//
|
//
|
||||||
case 'transaction_type':
|
case 'transaction_type':
|
||||||
$this->collector->setTypes([ucfirst($value)]);
|
$this->collector->setTypes([ucfirst($value)]);
|
||||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
|
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
|
||||||
@ -998,9 +998,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->excludeTypes([ucfirst($value)]);
|
$this->collector->excludeTypes([ucfirst($value)]);
|
||||||
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
|
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
|
||||||
break;
|
break;
|
||||||
//
|
//
|
||||||
// dates
|
// dates
|
||||||
//
|
//
|
||||||
case '-date_on':
|
case '-date_on':
|
||||||
case 'date_on':
|
case 'date_on':
|
||||||
$range = $this->parseDateRange($value);
|
$range = $this->parseDateRange($value);
|
||||||
@ -1150,9 +1150,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$range = $this->parseDateRange($value);
|
$range = $this->parseDateRange($value);
|
||||||
$this->setObjectDateAfterParams('updated_at', $range);
|
$this->setObjectDateAfterParams('updated_at', $range);
|
||||||
return false;
|
return false;
|
||||||
//
|
//
|
||||||
// external URL
|
// external URL
|
||||||
//
|
//
|
||||||
case '-any_external_url':
|
case '-any_external_url':
|
||||||
case 'no_external_url':
|
case 'no_external_url':
|
||||||
$this->collector->withoutExternalUrl();
|
$this->collector->withoutExternalUrl();
|
||||||
@ -1195,9 +1195,9 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
$this->collector->externalUrlDoesNotEnd($value);
|
$this->collector->externalUrlDoesNotEnd($value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
//
|
||||||
// other fields
|
// other fields
|
||||||
//
|
//
|
||||||
case 'external_id_is':
|
case 'external_id_is':
|
||||||
$this->collector->setExternalId($value);
|
$this->collector->setExternalId($value);
|
||||||
break;
|
break;
|
||||||
|
@ -67,11 +67,11 @@ class BudgetLimitTransformer extends AbstractTransformer
|
|||||||
*/
|
*/
|
||||||
public function transform(BudgetLimit $budgetLimit): array
|
public function transform(BudgetLimit $budgetLimit): array
|
||||||
{
|
{
|
||||||
// $repository = app(OperationsRepository::class);
|
// $repository = app(OperationsRepository::class);
|
||||||
// $repository->setUser($budgetLimit->budget->user);
|
// $repository->setUser($budgetLimit->budget->user);
|
||||||
// $expenses = $repository->sumExpenses(
|
// $expenses = $repository->sumExpenses(
|
||||||
// $budgetLimit->start_date, $budgetLimit->end_date, null, new Collection([$budgetLimit->budget]), $budgetLimit->transactionCurrency
|
// $budgetLimit->start_date, $budgetLimit->end_date, null, new Collection([$budgetLimit->budget]), $budgetLimit->transactionCurrency
|
||||||
// );
|
// );
|
||||||
$currency = $budgetLimit->transactionCurrency;
|
$currency = $budgetLimit->transactionCurrency;
|
||||||
$amount = $budgetLimit->amount;
|
$amount = $budgetLimit->amount;
|
||||||
$currencyDecimalPlaces = 2;
|
$currencyDecimalPlaces = 2;
|
||||||
|
@ -68,30 +68,30 @@ class BudgetTransformer extends AbstractTransformer
|
|||||||
$start = $this->parameters->get('start');
|
$start = $this->parameters->get('start');
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
//$autoBudget = $this->repository->getAutoBudget($budget);
|
//$autoBudget = $this->repository->getAutoBudget($budget);
|
||||||
// $spent = [];
|
// $spent = [];
|
||||||
// if (null !== $start && null !== $end) {
|
// if (null !== $start && null !== $end) {
|
||||||
// $spent = $this->beautify($this->opsRepository->sumExpenses($start, $end, null, new Collection([$budget])));
|
// $spent = $this->beautify($this->opsRepository->sumExpenses($start, $end, null, new Collection([$budget])));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $abCurrencyId = null;
|
// $abCurrencyId = null;
|
||||||
// $abCurrencyCode = null;
|
// $abCurrencyCode = null;
|
||||||
// $abType = null;
|
// $abType = null;
|
||||||
// $abAmount = null;
|
// $abAmount = null;
|
||||||
// $abPeriod = null;
|
// $abPeriod = null;
|
||||||
// $notes = $this->repository->getNoteText($budget);
|
// $notes = $this->repository->getNoteText($budget);
|
||||||
//
|
//
|
||||||
// $types = [
|
// $types = [
|
||||||
// AutoBudget::AUTO_BUDGET_RESET => 'reset',
|
// AutoBudget::AUTO_BUDGET_RESET => 'reset',
|
||||||
// AutoBudget::AUTO_BUDGET_ROLLOVER => 'rollover',
|
// AutoBudget::AUTO_BUDGET_ROLLOVER => 'rollover',
|
||||||
// ];
|
// ];
|
||||||
//
|
//
|
||||||
// if (null !== $autoBudget) {
|
// if (null !== $autoBudget) {
|
||||||
// $abCurrencyId = (string) $autoBudget->transactionCurrency->id;
|
// $abCurrencyId = (string) $autoBudget->transactionCurrency->id;
|
||||||
// $abCurrencyCode = $autoBudget->transactionCurrency->code;
|
// $abCurrencyCode = $autoBudget->transactionCurrency->code;
|
||||||
// $abType = $types[$autoBudget->auto_budget_type];
|
// $abType = $types[$autoBudget->auto_budget_type];
|
||||||
// $abAmount = number_format((float) $autoBudget->amount, $autoBudget->transactionCurrency->decimal_places, '.', '');
|
// $abAmount = number_format((float) $autoBudget->amount, $autoBudget->transactionCurrency->decimal_places, '.', '');
|
||||||
// $abPeriod = $autoBudget->period;
|
// $abPeriod = $autoBudget->period;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => (string)$budget->id,
|
'id' => (string)$budget->id,
|
||||||
|
@ -41,8 +41,8 @@ return [
|
|||||||
'host' => envNonEmpty('MAIL_HOST', 'smtp.mailtrap.io'),
|
'host' => envNonEmpty('MAIL_HOST', 'smtp.mailtrap.io'),
|
||||||
'port' => (int)env('MAIL_PORT', 2525),
|
'port' => (int)env('MAIL_PORT', 2525),
|
||||||
'encryption' => envNonEmpty('MAIL_ENCRYPTION', 'tls'),
|
'encryption' => envNonEmpty('MAIL_ENCRYPTION', 'tls'),
|
||||||
'username' => envNonEmpty('MAIL_USERNAME','user@example.com'),
|
'username' => envNonEmpty('MAIL_USERNAME', 'user@example.com'),
|
||||||
'password' => envNonEmpty('MAIL_PASSWORD','password'),
|
'password' => envNonEmpty('MAIL_PASSWORD', 'password'),
|
||||||
'timeout' => null,
|
'timeout' => null,
|
||||||
'verify_peer' => null !== env('MAIL_ENCRYPTION'),
|
'verify_peer' => null !== env('MAIL_ENCRYPTION'),
|
||||||
],
|
],
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,177 +68,257 @@ class CreateSupportTables extends Migration
|
|||||||
$this->createConfigurationTable();
|
$this->createConfigurationTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createAccountTypeTable(): void
|
private function createAccountTypeTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('account_types')) {
|
if (!Schema::hasTable('account_types')) {
|
||||||
Schema::create(
|
try {
|
||||||
'account_types',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'account_types',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->string('type', 50);
|
$table->timestamps();
|
||||||
|
$table->string('type', 50);
|
||||||
|
|
||||||
// type must be unique.
|
// type must be unique.
|
||||||
$table->unique(['type']);
|
$table->unique(['type']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "account_types": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createConfigurationTable(): void
|
private function createConfigurationTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('configuration')) {
|
if (!Schema::hasTable('configuration')) {
|
||||||
Schema::create(
|
try {
|
||||||
'configuration',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'configuration',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->string('name', 50);
|
$table->softDeletes();
|
||||||
$table->text('data');
|
$table->string('name', 50);
|
||||||
}
|
$table->text('data');
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "configuration": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createCurrencyTable(): void
|
private function createCurrencyTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('transaction_currencies')) {
|
if (!Schema::hasTable('transaction_currencies')) {
|
||||||
Schema::create(
|
try {
|
||||||
'transaction_currencies',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'transaction_currencies',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->string('code', 3);
|
$table->softDeletes();
|
||||||
$table->string('name', 255);
|
$table->string('code', 3);
|
||||||
$table->string('symbol', 12);
|
$table->string('name', 255);
|
||||||
|
$table->string('symbol', 12);
|
||||||
|
|
||||||
// code must be unique.
|
// code must be unique.
|
||||||
$table->unique(['code']);
|
$table->unique(['code']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "transaction_currencies": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createJobsTable(): void
|
private function createJobsTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('jobs')) {
|
if (!Schema::hasTable('jobs')) {
|
||||||
Schema::create(
|
try {
|
||||||
'jobs',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'jobs',
|
||||||
// straight from Laravel
|
static function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
// straight from Laravel
|
||||||
$table->string('queue');
|
$table->bigIncrements('id');
|
||||||
$table->longText('payload');
|
$table->string('queue');
|
||||||
$table->tinyInteger('attempts')->unsigned();
|
$table->longText('payload');
|
||||||
$table->tinyInteger('reserved')->unsigned();
|
$table->tinyInteger('attempts')->unsigned();
|
||||||
$table->unsignedInteger('reserved_at')->nullable();
|
$table->tinyInteger('reserved')->unsigned();
|
||||||
$table->unsignedInteger('available_at');
|
$table->unsignedInteger('reserved_at')->nullable();
|
||||||
$table->unsignedInteger('created_at');
|
$table->unsignedInteger('available_at');
|
||||||
$table->index(['queue', 'reserved', 'reserved_at']);
|
$table->unsignedInteger('created_at');
|
||||||
}
|
$table->index(['queue', 'reserved', 'reserved_at']);
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "jobs": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createPasswordTable(): void
|
private function createPasswordTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('password_resets')) {
|
if (!Schema::hasTable('password_resets')) {
|
||||||
Schema::create(
|
try {
|
||||||
'password_resets',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'password_resets',
|
||||||
// straight from laravel
|
static function (Blueprint $table) {
|
||||||
$table->string('email')->index();
|
// straight from laravel
|
||||||
$table->string('token')->index();
|
$table->string('email')->index();
|
||||||
$table->timestamp('created_at')->nullable();
|
$table->string('token')->index();
|
||||||
}
|
$table->timestamp('created_at')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "password_resets": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createPermissionRoleTable(): void
|
private function createPermissionRoleTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('permission_role')) {
|
if (!Schema::hasTable('permission_role')) {
|
||||||
Schema::create(
|
try {
|
||||||
'permission_role',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'permission_role',
|
||||||
$table->integer('permission_id')->unsigned();
|
static function (Blueprint $table) {
|
||||||
$table->integer('role_id')->unsigned();
|
$table->integer('permission_id')->unsigned();
|
||||||
|
$table->integer('role_id')->unsigned();
|
||||||
|
|
||||||
$table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade');
|
$table->foreign('permission_id')->references('id')->on('permissions')->onUpdate('cascade')->onDelete('cascade');
|
||||||
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade');
|
$table->foreign('role_id')->references('id')->on('roles')->onUpdate('cascade')->onDelete('cascade');
|
||||||
|
|
||||||
$table->primary(['permission_id', 'role_id']);
|
$table->primary(['permission_id', 'role_id']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "permission_role": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createPermissionsTable(): void
|
private function createPermissionsTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('permissions')) {
|
if (!Schema::hasTable('permissions')) {
|
||||||
Schema::create(
|
try {
|
||||||
'permissions',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'permissions',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->string('name')->unique();
|
$table->timestamps();
|
||||||
$table->string('display_name')->nullable();
|
$table->string('name')->unique();
|
||||||
$table->string('description')->nullable();
|
$table->string('display_name')->nullable();
|
||||||
}
|
$table->string('description')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "permissions": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createRolesTable(): void
|
private function createRolesTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('roles')) {
|
if (!Schema::hasTable('roles')) {
|
||||||
Schema::create(
|
try {
|
||||||
'roles',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'roles',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->string('name')->unique();
|
$table->timestamps();
|
||||||
$table->string('display_name')->nullable();
|
$table->string('name')->unique();
|
||||||
$table->string('description')->nullable();
|
$table->string('display_name')->nullable();
|
||||||
}
|
$table->string('description')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "roles": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createSessionsTable(): void
|
private function createSessionsTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('sessions')) {
|
if (!Schema::hasTable('sessions')) {
|
||||||
Schema::create(
|
try {
|
||||||
'sessions',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'sessions',
|
||||||
$table->string('id')->unique();
|
static function (Blueprint $table) {
|
||||||
$table->integer('user_id')->nullable();
|
$table->string('id')->unique();
|
||||||
$table->string('ip_address', 45)->nullable();
|
$table->integer('user_id')->nullable();
|
||||||
$table->text('user_agent')->nullable();
|
$table->string('ip_address', 45)->nullable();
|
||||||
$table->text('payload');
|
$table->text('user_agent')->nullable();
|
||||||
$table->integer('last_activity');
|
$table->text('payload');
|
||||||
}
|
$table->integer('last_activity');
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "sessions": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function createTransactionTypeTable(): void
|
private function createTransactionTypeTable(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('transaction_types')) {
|
if (!Schema::hasTable('transaction_types')) {
|
||||||
Schema::create(
|
try {
|
||||||
'transaction_types',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'transaction_types',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->string('type', 50);
|
$table->softDeletes();
|
||||||
|
$table->string('type', 50);
|
||||||
|
|
||||||
// type must be unique.
|
// type must be unique.
|
||||||
$table->unique(['type']);
|
$table->unique(['type']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "transaction_types": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,19 +48,24 @@ class CreateUsersTable extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('users')) {
|
if (!Schema::hasTable('users')) {
|
||||||
Schema::create(
|
try {
|
||||||
'users',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'users',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->string('email', 255);
|
$table->timestamps();
|
||||||
$table->string('password', 60);
|
$table->string('email', 255);
|
||||||
$table->string('remember_token', 100)->nullable();
|
$table->string('password', 60);
|
||||||
$table->string('reset', 32)->nullable();
|
$table->string('remember_token', 100)->nullable();
|
||||||
$table->tinyInteger('blocked', false, true)->default('0');
|
$table->string('reset', 32)->nullable();
|
||||||
$table->string('blocked_code', 25)->nullable();
|
$table->tinyInteger('blocked', false, true)->default('0');
|
||||||
}
|
$table->string('blocked_code', 25)->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "users": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,17 +47,22 @@ class ChangesForV410 extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'notes',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'notes',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('noteable_id', false, true);
|
$table->softDeletes();
|
||||||
$table->string('noteable_type');
|
$table->integer('noteable_id', false, true);
|
||||||
$table->string('title')->nullable();
|
$table->string('noteable_type');
|
||||||
$table->text('text')->nullable();
|
$table->string('title')->nullable();
|
||||||
}
|
$table->text('text')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "notes": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,21 +47,26 @@ class ChangesForV430 extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'available_budgets',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'available_budgets',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('user_id', false, true);
|
$table->softDeletes();
|
||||||
$table->integer('transaction_currency_id', false, true);
|
$table->integer('user_id', false, true);
|
||||||
$table->decimal('amount', 32, 12);
|
$table->integer('transaction_currency_id', false, true);
|
||||||
$table->date('start_date');
|
$table->decimal('amount', 32, 12);
|
||||||
$table->date('end_date');
|
$table->date('start_date');
|
||||||
|
$table->date('end_date');
|
||||||
|
|
||||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "available_budgets": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,24 +63,29 @@ class ChangesForV440 extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('currency_exchange_rates')) {
|
if (!Schema::hasTable('currency_exchange_rates')) {
|
||||||
Schema::create(
|
try {
|
||||||
'currency_exchange_rates',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'currency_exchange_rates',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('user_id', false, true);
|
$table->softDeletes();
|
||||||
$table->integer('from_currency_id', false, true);
|
$table->integer('user_id', false, true);
|
||||||
$table->integer('to_currency_id', false, true);
|
$table->integer('from_currency_id', false, true);
|
||||||
$table->date('date');
|
$table->integer('to_currency_id', false, true);
|
||||||
$table->decimal('rate', 32, 12);
|
$table->date('date');
|
||||||
$table->decimal('user_rate', 32, 12)->nullable();
|
$table->decimal('rate', 32, 12);
|
||||||
|
$table->decimal('user_rate', 32, 12)->nullable();
|
||||||
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
$table->foreign('from_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
$table->foreign('from_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
$table->foreign('to_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
$table->foreign('to_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "notifications": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Schema::table(
|
Schema::table(
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -49,40 +50,50 @@ class ChangesForV470 extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('link_types')) {
|
if (!Schema::hasTable('link_types')) {
|
||||||
Schema::create(
|
try {
|
||||||
'link_types',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'link_types',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->string('name');
|
$table->softDeletes();
|
||||||
$table->string('outward');
|
$table->string('name');
|
||||||
$table->string('inward');
|
$table->string('outward');
|
||||||
$table->boolean('editable');
|
$table->string('inward');
|
||||||
|
$table->boolean('editable');
|
||||||
|
|
||||||
$table->unique(['name', 'outward', 'inward']);
|
$table->unique(['name', 'outward', 'inward']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "link_types": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Schema::hasTable('journal_links')) {
|
if (!Schema::hasTable('journal_links')) {
|
||||||
Schema::create(
|
try {
|
||||||
'journal_links',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'journal_links',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->integer('link_type_id', false, true);
|
$table->timestamps();
|
||||||
$table->integer('source_id', false, true);
|
$table->integer('link_type_id', false, true);
|
||||||
$table->integer('destination_id', false, true);
|
$table->integer('source_id', false, true);
|
||||||
$table->text('comment')->nullable();
|
$table->integer('destination_id', false, true);
|
||||||
|
$table->text('comment')->nullable();
|
||||||
|
|
||||||
$table->foreign('link_type_id')->references('id')->on('link_types')->onDelete('cascade');
|
$table->foreign('link_type_id')->references('id')->on('link_types')->onDelete('cascade');
|
||||||
$table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
$table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
|
|
||||||
$table->unique(['link_type_id', 'source_id', 'destination_id']);
|
$table->unique(['link_type_id', 'source_id', 'destination_id']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "journal_links": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -47,16 +48,21 @@ class CreateOauthAuthCodesTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'oauth_auth_codes',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'oauth_auth_codes',
|
||||||
$table->string('id', 100)->primary();
|
static function (Blueprint $table) {
|
||||||
$table->integer('user_id');
|
$table->string('id', 100)->primary();
|
||||||
$table->integer('client_id');
|
$table->integer('user_id');
|
||||||
$table->text('scopes')->nullable();
|
$table->integer('client_id');
|
||||||
$table->boolean('revoked');
|
$table->text('scopes')->nullable();
|
||||||
$table->dateTime('expires_at')->nullable();
|
$table->boolean('revoked');
|
||||||
}
|
$table->dateTime('expires_at')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "oauth_auth_codes": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -47,18 +48,23 @@ class CreateOauthAccessTokensTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'oauth_access_tokens',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'oauth_access_tokens',
|
||||||
$table->string('id', 100)->primary();
|
static function (Blueprint $table) {
|
||||||
$table->integer('user_id')->index()->nullable();
|
$table->string('id', 100)->primary();
|
||||||
$table->integer('client_id');
|
$table->integer('user_id')->index()->nullable();
|
||||||
$table->string('name')->nullable();
|
$table->integer('client_id');
|
||||||
$table->text('scopes')->nullable();
|
$table->string('name')->nullable();
|
||||||
$table->boolean('revoked');
|
$table->text('scopes')->nullable();
|
||||||
$table->timestamps();
|
$table->boolean('revoked');
|
||||||
$table->dateTime('expires_at')->nullable();
|
$table->timestamps();
|
||||||
}
|
$table->dateTime('expires_at')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "oauth_access_tokens": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -47,14 +48,19 @@ class CreateOauthRefreshTokensTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'oauth_refresh_tokens',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'oauth_refresh_tokens',
|
||||||
$table->string('id', 100)->primary();
|
static function (Blueprint $table) {
|
||||||
$table->string('access_token_id', 100)->index();
|
$table->string('id', 100)->primary();
|
||||||
$table->boolean('revoked');
|
$table->string('access_token_id', 100)->index();
|
||||||
$table->dateTime('expires_at')->nullable();
|
$table->boolean('revoked');
|
||||||
}
|
$table->dateTime('expires_at')->nullable();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "oauth_refresh_tokens": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -47,19 +48,24 @@ class CreateOauthClientsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'oauth_clients',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'oauth_clients',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->integer('user_id')->index()->nullable();
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->integer('user_id')->index()->nullable();
|
||||||
$table->string('secret', 100);
|
$table->string('name');
|
||||||
$table->text('redirect');
|
$table->string('secret', 100);
|
||||||
$table->boolean('personal_access_client');
|
$table->text('redirect');
|
||||||
$table->boolean('password_client');
|
$table->boolean('personal_access_client');
|
||||||
$table->boolean('revoked');
|
$table->boolean('password_client');
|
||||||
$table->timestamps();
|
$table->boolean('revoked');
|
||||||
}
|
$table->timestamps();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "oauth_clients": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -47,13 +48,18 @@ class CreateOauthPersonalAccessClientsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'oauth_personal_access_clients',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'oauth_personal_access_clients',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->integer('client_id')->index();
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->integer('client_id')->index();
|
||||||
}
|
$table->timestamps();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "oauth_personal_access_clients": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,99 +56,122 @@ class ChangesForV475 extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'recurrences',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'recurrences',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('user_id', false, true);
|
$table->softDeletes();
|
||||||
$table->integer('transaction_type_id', false, true);
|
$table->integer('user_id', false, true);
|
||||||
|
$table->integer('transaction_type_id', false, true);
|
||||||
|
|
||||||
$table->string('title', 1024);
|
$table->string('title', 1024);
|
||||||
$table->text('description');
|
$table->text('description');
|
||||||
|
|
||||||
$table->date('first_date');
|
$table->date('first_date');
|
||||||
$table->date('repeat_until')->nullable();
|
$table->date('repeat_until')->nullable();
|
||||||
$table->date('latest_date')->nullable();
|
$table->date('latest_date')->nullable();
|
||||||
$table->smallInteger('repetitions', false, true);
|
$table->smallInteger('repetitions', false, true);
|
||||||
|
|
||||||
$table->boolean('apply_rules')->default(true);
|
$table->boolean('apply_rules')->default(true);
|
||||||
$table->boolean('active')->default(true);
|
$table->boolean('active')->default(true);
|
||||||
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
$table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');
|
$table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "recurrences": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Schema::create(
|
||||||
|
'recurrences_transactions',
|
||||||
|
static function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->integer('recurrence_id', false, true);
|
||||||
|
$table->integer('transaction_currency_id', false, true);
|
||||||
|
$table->integer('foreign_currency_id', false, true)->nullable();
|
||||||
|
$table->integer('source_id', false, true);
|
||||||
|
$table->integer('destination_id', false, true);
|
||||||
|
|
||||||
Schema::create(
|
$table->decimal('amount', 32, 12);
|
||||||
'recurrences_transactions',
|
$table->decimal('foreign_amount', 32, 12)->nullable();
|
||||||
static function (Blueprint $table) {
|
$table->string('description', 1024);
|
||||||
$table->increments('id');
|
|
||||||
$table->timestamps();
|
|
||||||
$table->softDeletes();
|
|
||||||
$table->integer('recurrence_id', false, true);
|
|
||||||
$table->integer('transaction_currency_id', false, true);
|
|
||||||
$table->integer('foreign_currency_id', false, true)->nullable();
|
|
||||||
$table->integer('source_id', false, true);
|
|
||||||
$table->integer('destination_id', false, true);
|
|
||||||
|
|
||||||
$table->decimal('amount', 32, 12);
|
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
||||||
$table->decimal('foreign_amount', 32, 12)->nullable();
|
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
$table->string('description', 1024);
|
$table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
|
||||||
|
$table->foreign('source_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
|
$table->foreign('destination_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "recurrences_transactions": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
|
||||||
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
try {
|
||||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
Schema::create(
|
||||||
$table->foreign('foreign_currency_id')->references('id')->on('transaction_currencies')->onDelete('set null');
|
'recurrences_repetitions',
|
||||||
$table->foreign('source_id')->references('id')->on('accounts')->onDelete('cascade');
|
static function (Blueprint $table) {
|
||||||
$table->foreign('destination_id')->references('id')->on('accounts')->onDelete('cascade');
|
$table->increments('id');
|
||||||
}
|
$table->timestamps();
|
||||||
);
|
$table->softDeletes();
|
||||||
|
$table->integer('recurrence_id', false, true);
|
||||||
|
$table->string('repetition_type', 50);
|
||||||
|
$table->string('repetition_moment', 50);
|
||||||
|
$table->smallInteger('repetition_skip', false, true);
|
||||||
|
$table->smallInteger('weekend', false, true);
|
||||||
|
|
||||||
Schema::create(
|
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
||||||
'recurrences_repetitions',
|
}
|
||||||
static function (Blueprint $table) {
|
);
|
||||||
$table->increments('id');
|
} catch (QueryException $e) {
|
||||||
$table->timestamps();
|
Log::error(sprintf('Could not create table "recurrences_repetitions": %s', $e->getMessage()));
|
||||||
$table->softDeletes();
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
$table->integer('recurrence_id', false, true);
|
}
|
||||||
$table->string('repetition_type', 50);
|
|
||||||
$table->string('repetition_moment', 50);
|
|
||||||
$table->smallInteger('repetition_skip', false, true);
|
|
||||||
$table->smallInteger('weekend', false, true);
|
|
||||||
|
|
||||||
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
try {
|
||||||
}
|
Schema::create(
|
||||||
);
|
'recurrences_meta',
|
||||||
|
static function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->integer('recurrence_id', false, true);
|
||||||
|
|
||||||
Schema::create(
|
$table->string('name', 50);
|
||||||
'recurrences_meta',
|
$table->text('value');
|
||||||
static function (Blueprint $table) {
|
|
||||||
$table->increments('id');
|
|
||||||
$table->timestamps();
|
|
||||||
$table->softDeletes();
|
|
||||||
$table->integer('recurrence_id', false, true);
|
|
||||||
|
|
||||||
$table->string('name', 50);
|
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
||||||
$table->text('value');
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "recurrences_meta": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Schema::create(
|
||||||
|
'rt_meta',
|
||||||
|
static function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->integer('rt_id', false, true);
|
||||||
|
|
||||||
$table->foreign('recurrence_id')->references('id')->on('recurrences')->onDelete('cascade');
|
$table->string('name', 50);
|
||||||
}
|
$table->text('value');
|
||||||
);
|
|
||||||
|
|
||||||
Schema::create(
|
$table->foreign('rt_id')->references('id')->on('recurrences_transactions')->onDelete('cascade');
|
||||||
'rt_meta',
|
}
|
||||||
static function (Blueprint $table) {
|
);
|
||||||
$table->increments('id');
|
} catch (QueryException $e) {
|
||||||
$table->timestamps();
|
Log::error(sprintf('Could not create table "rt_meta": %s', $e->getMessage()));
|
||||||
$table->softDeletes();
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
$table->integer('rt_id', false, true);
|
}
|
||||||
|
|
||||||
$table->string('name', 50);
|
|
||||||
$table->text('value');
|
|
||||||
|
|
||||||
$table->foreign('rt_id')->references('id')->on('recurrences_transactions')->onDelete('cascade');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class ChangesForV479 extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'transaction_currencies',
|
'transaction_currencies',
|
||||||
@ -53,7 +53,7 @@ class ChangesForV479 extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'transaction_currencies',
|
'transaction_currencies',
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -53,35 +54,45 @@ class ChangesForV4710 extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('transaction_groups')) {
|
if (!Schema::hasTable('transaction_groups')) {
|
||||||
Schema::create(
|
try {
|
||||||
'transaction_groups',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'transaction_groups',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('user_id', false, true);
|
$table->softDeletes();
|
||||||
$table->string('title', 1024)->nullable();
|
$table->integer('user_id', false, true);
|
||||||
|
$table->string('title', 1024)->nullable();
|
||||||
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "transaction_groups": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Schema::hasTable('group_journals')) {
|
if (!Schema::hasTable('group_journals')) {
|
||||||
Schema::create(
|
try {
|
||||||
'group_journals',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'group_journals',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->integer('transaction_group_id', false, true);
|
$table->increments('id');
|
||||||
$table->integer('transaction_journal_id', false, true);
|
$table->integer('transaction_group_id', false, true);
|
||||||
|
$table->integer('transaction_journal_id', false, true);
|
||||||
|
|
||||||
$table->foreign('transaction_group_id')->references('id')->on('transaction_groups')->onDelete('cascade');
|
$table->foreign('transaction_group_id')->references('id')->on('transaction_groups')->onDelete('cascade');
|
||||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||||
|
|
||||||
// unique combi:
|
// unique combi:
|
||||||
$table->unique(['transaction_group_id', 'transaction_journal_id'], 'unique_in_group');
|
$table->unique(['transaction_group_id', 'transaction_journal_id'], 'unique_in_group');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "group_journals": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ class MakeLocationsTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('locations');
|
Schema::dropIfExists('locations');
|
||||||
}
|
}
|
||||||
@ -48,22 +49,27 @@ class MakeLocationsTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create(
|
try {
|
||||||
'locations',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'locations',
|
||||||
$table->bigIncrements('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->bigIncrements('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
$table->integer('locatable_id', false, true);
|
$table->integer('locatable_id', false, true);
|
||||||
$table->string('locatable_type', 255);
|
$table->string('locatable_type', 255);
|
||||||
|
|
||||||
$table->decimal('latitude', 12, 8)->nullable();
|
$table->decimal('latitude', 12, 8)->nullable();
|
||||||
$table->decimal('longitude', 12, 8)->nullable();
|
$table->decimal('longitude', 12, 8)->nullable();
|
||||||
$table->smallInteger('zoom_level', false, true)->nullable();
|
$table->smallInteger('zoom_level', false, true)->nullable();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "locations": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,40 +51,27 @@ class ChangesForV520 extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('auto_budgets')) {
|
if (!Schema::hasTable('auto_budgets')) {
|
||||||
Schema::create(
|
try {
|
||||||
'auto_budgets',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'auto_budgets',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('budget_id', false, true);
|
$table->softDeletes();
|
||||||
$table->integer('transaction_currency_id', false, true);
|
$table->integer('budget_id', false, true);
|
||||||
$table->tinyInteger('auto_budget_type', false, true)->default(1);
|
$table->integer('transaction_currency_id', false, true);
|
||||||
$table->decimal('amount', 32, 12);
|
$table->tinyInteger('auto_budget_type', false, true)->default(1);
|
||||||
$table->string('period', 50);
|
$table->decimal('amount', 32, 12);
|
||||||
|
$table->string('period', 50);
|
||||||
|
|
||||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "auto_budgets": %s', $e->getMessage()));
|
||||||
if (!Schema::hasTable('telemetry')) {
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
Schema::create(
|
}
|
||||||
'telemetry',
|
|
||||||
static function (Blueprint $table) {
|
|
||||||
$table->increments('id');
|
|
||||||
$table->timestamps();
|
|
||||||
$table->dateTime('submitted')->nullable();
|
|
||||||
$table->integer('user_id', false, true)->nullable();
|
|
||||||
$table->string('installation_id', 50);
|
|
||||||
$table->string('type', 25);
|
|
||||||
$table->string('key', 50);
|
|
||||||
$table->text('value');
|
|
||||||
|
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,28 +52,39 @@ class ChangesForV530 extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('object_groups')) {
|
if (!Schema::hasTable('object_groups')) {
|
||||||
Schema::create(
|
try {
|
||||||
'object_groups',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'object_groups',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->integer('user_id', false, true);
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->integer('user_id', false, true);
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->string('title', 255);
|
$table->softDeletes();
|
||||||
$table->mediumInteger('order', false, true)->default(0);
|
$table->string('title', 255);
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->mediumInteger('order', false, true)->default(0);
|
||||||
}
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "object_groups": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Schema::hasTable('object_groupables')) {
|
if (!Schema::hasTable('object_groupables')) {
|
||||||
Schema::create(
|
try {
|
||||||
'object_groupables',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'object_groupables',
|
||||||
$table->integer('object_group_id');
|
static function (Blueprint $table) {
|
||||||
$table->integer('object_groupable_id', false, true);
|
$table->integer('object_group_id');
|
||||||
$table->string('object_groupable_type', 255);
|
$table->integer('object_groupable_id', false, true);
|
||||||
}
|
$table->string('object_groupable_type', 255);
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "object_groupables": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -36,25 +37,31 @@ class ChangesForV550 extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// recreate jobs table.
|
// recreate jobs table.
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
Schema::create(
|
|
||||||
'jobs',
|
try {
|
||||||
static function (Blueprint $table) {
|
Schema::create(
|
||||||
// straight from Laravel (this is the OLD table)
|
'jobs',
|
||||||
$table->bigIncrements('id');
|
static function (Blueprint $table) {
|
||||||
$table->string('queue');
|
// straight from Laravel (this is the OLD table)
|
||||||
$table->longText('payload');
|
$table->bigIncrements('id');
|
||||||
$table->tinyInteger('attempts')->unsigned();
|
$table->string('queue');
|
||||||
$table->tinyInteger('reserved')->unsigned();
|
$table->longText('payload');
|
||||||
$table->unsignedInteger('reserved_at')->nullable();
|
$table->tinyInteger('attempts')->unsigned();
|
||||||
$table->unsignedInteger('available_at');
|
$table->tinyInteger('reserved')->unsigned();
|
||||||
$table->unsignedInteger('created_at');
|
$table->unsignedInteger('reserved_at')->nullable();
|
||||||
$table->index(['queue', 'reserved', 'reserved_at']);
|
$table->unsignedInteger('available_at');
|
||||||
}
|
$table->unsignedInteger('created_at');
|
||||||
);
|
$table->index(['queue', 'reserved', 'reserved_at']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "jobs": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
|
||||||
// expand budget / transaction journal table.
|
// expand budget / transaction journal table.
|
||||||
Schema::table(
|
Schema::table(
|
||||||
@ -86,39 +93,49 @@ class ChangesForV550 extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
// drop and recreate jobs table.
|
// drop and recreate jobs table.
|
||||||
Schema::dropIfExists('jobs');
|
Schema::dropIfExists('jobs');
|
||||||
// this is the NEW table
|
// this is the NEW table
|
||||||
Schema::create(
|
try {
|
||||||
'jobs',
|
Schema::create(
|
||||||
function (Blueprint $table) {
|
'jobs',
|
||||||
$table->bigIncrements('id');
|
function (Blueprint $table) {
|
||||||
$table->string('queue')->index();
|
$table->bigIncrements('id');
|
||||||
$table->longText('payload');
|
$table->string('queue')->index();
|
||||||
$table->unsignedTinyInteger('attempts');
|
$table->longText('payload');
|
||||||
$table->unsignedInteger('reserved_at')->nullable();
|
$table->unsignedTinyInteger('attempts');
|
||||||
$table->unsignedInteger('available_at');
|
$table->unsignedInteger('reserved_at')->nullable();
|
||||||
$table->unsignedInteger('created_at');
|
$table->unsignedInteger('available_at');
|
||||||
}
|
$table->unsignedInteger('created_at');
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "jobs": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
// drop failed jobs table.
|
// drop failed jobs table.
|
||||||
Schema::dropIfExists('failed_jobs');
|
Schema::dropIfExists('failed_jobs');
|
||||||
|
|
||||||
// create new failed_jobs table.
|
// create new failed_jobs table.
|
||||||
Schema::create(
|
try {
|
||||||
'failed_jobs',
|
Schema::create(
|
||||||
function (Blueprint $table) {
|
'failed_jobs',
|
||||||
$table->bigIncrements('id');
|
function (Blueprint $table) {
|
||||||
$table->string('uuid')->unique();
|
$table->bigIncrements('id');
|
||||||
$table->text('connection');
|
$table->string('uuid')->unique();
|
||||||
$table->text('queue');
|
$table->text('connection');
|
||||||
$table->longText('payload');
|
$table->text('queue');
|
||||||
$table->longText('exception');
|
$table->longText('payload');
|
||||||
$table->timestamp('failed_at')->useCurrent();
|
$table->longText('exception');
|
||||||
}
|
$table->timestamp('failed_at')->useCurrent();
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "failed_jobs": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
|
||||||
// update budget / transaction journal table.
|
// update budget / transaction journal table.
|
||||||
Schema::table(
|
Schema::table(
|
||||||
@ -147,62 +164,77 @@ class ChangesForV550 extends Migration
|
|||||||
|
|
||||||
// new webhooks table
|
// new webhooks table
|
||||||
if (!Schema::hasTable('webhooks')) {
|
if (!Schema::hasTable('webhooks')) {
|
||||||
Schema::create(
|
try {
|
||||||
'webhooks',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'webhooks',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('user_id', false, true);
|
$table->softDeletes();
|
||||||
$table->string('title', 255)->index();
|
$table->integer('user_id', false, true);
|
||||||
$table->string('secret', 32)->index();
|
$table->string('title', 255)->index();
|
||||||
$table->boolean('active')->default(true);
|
$table->string('secret', 32)->index();
|
||||||
$table->unsignedSmallInteger('trigger', false);
|
$table->boolean('active')->default(true);
|
||||||
$table->unsignedSmallInteger('response', false);
|
$table->unsignedSmallInteger('trigger', false);
|
||||||
$table->unsignedSmallInteger('delivery', false);
|
$table->unsignedSmallInteger('response', false);
|
||||||
$table->string('url', 1024);
|
$table->unsignedSmallInteger('delivery', false);
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
$table->string('url', 1024);
|
||||||
$table->unique(['user_id', 'title']);
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
}
|
$table->unique(['user_id', 'title']);
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "webhooks": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// new webhook_messages table
|
// new webhook_messages table
|
||||||
if (!Schema::hasTable('webhook_messages')) {
|
if (!Schema::hasTable('webhook_messages')) {
|
||||||
Schema::create(
|
try {
|
||||||
'webhook_messages',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'webhook_messages',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->boolean('sent')->default(false);
|
$table->softDeletes();
|
||||||
$table->boolean('errored')->default(false);
|
$table->boolean('sent')->default(false);
|
||||||
|
$table->boolean('errored')->default(false);
|
||||||
|
|
||||||
$table->integer('webhook_id', false, true);
|
$table->integer('webhook_id', false, true);
|
||||||
$table->string('uuid', 64);
|
$table->string('uuid', 64);
|
||||||
$table->longText('message');
|
$table->longText('message');
|
||||||
|
|
||||||
$table->foreign('webhook_id')->references('id')->on('webhooks')->onDelete('cascade');
|
$table->foreign('webhook_id')->references('id')->on('webhooks')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "webhook_messages": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Schema::hasTable('webhook_attempts')) {
|
if (!Schema::hasTable('webhook_attempts')) {
|
||||||
Schema::create(
|
try {
|
||||||
'webhook_attempts',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'webhook_attempts',
|
||||||
$table->increments('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->increments('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
$table->integer('webhook_message_id', false, true);
|
$table->softDeletes();
|
||||||
$table->unsignedSmallInteger('status_code')->default(0);
|
$table->integer('webhook_message_id', false, true);
|
||||||
|
$table->unsignedSmallInteger('status_code')->default(0);
|
||||||
|
|
||||||
$table->longText('logs')->nullable();
|
$table->longText('logs')->nullable();
|
||||||
$table->longText('response')->nullable();
|
$table->longText('response')->nullable();
|
||||||
|
|
||||||
$table->foreign('webhook_message_id')->references('id')->on('webhook_messages')->onDelete('cascade');
|
$table->foreign('webhook_message_id')->references('id')->on('webhook_messages')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "webhook_attempts": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class AddLdapColumnsToUsersTable extends Migration
|
|||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'users',
|
'users',
|
||||||
@ -44,7 +44,7 @@ class AddLdapColumnsToUsersTable extends Migration
|
|||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'users',
|
'users',
|
||||||
|
@ -36,7 +36,7 @@ class ExtendCurrencyInfo extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ class ExtendCurrencyInfo extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'transaction_currencies',
|
'transaction_currencies',
|
||||||
|
@ -35,7 +35,7 @@ class DropTeleTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('telemetry');
|
Schema::dropIfExists('telemetry');
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ class DropTeleTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('telemetry');
|
Schema::dropIfExists('telemetry');
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ class UserGroups extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
// remove columns from tables
|
// remove columns from tables
|
||||||
/** @var string $tableName */
|
/** @var string $tableName */
|
||||||
@ -89,52 +90,66 @@ class UserGroups extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* user is a member of a user_group through a user_group_role
|
* user is a member of a user_group through a user_group_role
|
||||||
* may have multiple roles in a group
|
* may have multiple roles in a group
|
||||||
*/
|
*/
|
||||||
Schema::create(
|
try {
|
||||||
'user_groups',
|
Schema::create(
|
||||||
static function (Blueprint $table) {
|
'user_groups',
|
||||||
$table->bigIncrements('id');
|
static function (Blueprint $table) {
|
||||||
$table->timestamps();
|
$table->bigIncrements('id');
|
||||||
$table->softDeletes();
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
$table->string('title', 255);
|
$table->string('title', 255);
|
||||||
$table->unique('title');
|
$table->unique('title');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "user_groups": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Schema::create(
|
||||||
|
'user_roles',
|
||||||
|
static function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
Schema::create(
|
$table->string('title', 255);
|
||||||
'user_roles',
|
$table->unique('title');
|
||||||
static function (Blueprint $table) {
|
}
|
||||||
$table->bigIncrements('id');
|
);
|
||||||
$table->timestamps();
|
} catch (QueryException $e) {
|
||||||
$table->softDeletes();
|
Log::error(sprintf('Could not create table "user_roles": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
|
|
||||||
$table->string('title', 255);
|
try {
|
||||||
$table->unique('title');
|
Schema::create(
|
||||||
}
|
'group_memberships',
|
||||||
);
|
static function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
$table->integer('user_id', false, true);
|
||||||
|
$table->bigInteger('user_group_id', false, true);
|
||||||
|
$table->bigInteger('user_role_id', false, true);
|
||||||
|
|
||||||
Schema::create(
|
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
|
||||||
'group_memberships',
|
$table->foreign('user_group_id')->references('id')->on('user_groups')->onUpdate('cascade')->onDelete('cascade');
|
||||||
static function (Blueprint $table) {
|
$table->foreign('user_role_id')->references('id')->on('user_roles')->onUpdate('cascade')->onDelete('cascade');
|
||||||
$table->bigIncrements('id');
|
$table->unique(['user_id', 'user_group_id', 'user_role_id']);
|
||||||
$table->timestamps();
|
}
|
||||||
$table->softDeletes();
|
);
|
||||||
$table->integer('user_id', false, true);
|
} catch (QueryException $e) {
|
||||||
$table->bigInteger('user_group_id', false, true);
|
Log::error(sprintf('Could not create table "group_memberships": %s', $e->getMessage()));
|
||||||
$table->bigInteger('user_role_id', false, true);
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
|
|
||||||
$table->foreign('user_group_id')->references('id')->on('user_groups')->onUpdate('cascade')->onDelete('cascade');
|
|
||||||
$table->foreign('user_role_id')->references('id')->on('user_roles')->onUpdate('cascade')->onDelete('cascade');
|
|
||||||
$table->unique(['user_id', 'user_group_id', 'user_role_id']);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'users',
|
'users',
|
||||||
function (Blueprint $table) {
|
function (Blueprint $table) {
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ class CreateLocalPersonalAccessTokensTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('personal_access_tokens');
|
Schema::dropIfExists('personal_access_tokens');
|
||||||
}
|
}
|
||||||
@ -46,18 +47,23 @@ class CreateLocalPersonalAccessTokensTable extends Migration
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
if (!Schema::hasTable('personal_access_tokens')) {
|
if (!Schema::hasTable('personal_access_tokens')) {
|
||||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
try {
|
||||||
$table->bigIncrements('id');
|
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||||
$table->morphs('tokenable');
|
$table->bigIncrements('id');
|
||||||
$table->string('name');
|
$table->morphs('tokenable');
|
||||||
$table->string('token', 64)->unique();
|
$table->string('name');
|
||||||
$table->text('abilities')->nullable();
|
$table->string('token', 64)->unique();
|
||||||
$table->timestamp('last_used_at')->nullable();
|
$table->text('abilities')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamp('last_used_at')->nullable();
|
||||||
});
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
} catch (QueryException $e) {
|
||||||
|
Log::error(sprintf('Could not create table "personal_access_tokens": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
return new class() extends Migration {
|
return new class () extends Migration {
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
@ -47,11 +47,13 @@ return new class() extends Migration {
|
|||||||
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
$table->bigInteger('user_group_id', false, true)->nullable()->after('user_id');
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not add column "user_group_id" to table "currency_exchange_rates": %s', $e->getMessage()));
|
Log::error(sprintf('Could not add column "user_group_id" to table "currency_exchange_rates": %s', $e->getMessage()));
|
||||||
|
Log::error('If the column exists already (see error), this is not a problem. Otherwise, please create a GitHub discussion.');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$table->foreign('user_group_id', 'cer_to_ugi')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
$table->foreign('user_group_id', 'cer_to_ugi')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade');
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not add foreign key "cer_to_ugi" to table "currency_exchange_rates": %s', $e->getMessage()));
|
Log::error(sprintf('Could not add foreign key "cer_to_ugi" to table "currency_exchange_rates": %s', $e->getMessage()));
|
||||||
|
Log::error('If the foreign key exists already (see error), this is not a problem. Otherwise, please create a GitHub discussion.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,12 +74,14 @@ return new class() extends Migration {
|
|||||||
$table->dropForeign('cer_to_ugi');
|
$table->dropForeign('cer_to_ugi');
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not drop foreign key "cer_to_ugi" from table "currency_exchange_rates": %s', $e->getMessage()));
|
Log::error(sprintf('Could not drop foreign key "cer_to_ugi" from table "currency_exchange_rates": %s', $e->getMessage()));
|
||||||
|
Log::error('If the foreign key does not exist (see error message), this is not a problem. Otherwise, please create a GitHub discussion.');
|
||||||
}
|
}
|
||||||
if (Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
if (Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
|
||||||
try {
|
try {
|
||||||
$table->dropColumn('user_group_id');
|
$table->dropColumn('user_group_id');
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not drop column "user_group_id" from table "currency_exchange_rates": %s', $e->getMessage()));
|
Log::error(sprintf('Could not drop column "user_group_id" from table "currency_exchange_rates": %s', $e->getMessage()));
|
||||||
|
Log::error('If the column does not exist (see error message), this is not a problem. Otherwise, please create a GitHub discussion.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,13 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class() extends Migration {
|
return new class () extends Migration {
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Schema::create('notifications', function (Blueprint $table) {
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
@ -47,6 +47,7 @@ return new class() extends Migration {
|
|||||||
});
|
});
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not create table "notifications": %s', $e->getMessage()));
|
Log::error(sprintf('Could not create table "notifications": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ return new class() extends Migration {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('notifications');
|
Schema::dropIfExists('notifications');
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class() extends Migration {
|
return new class () extends Migration {
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
@ -49,6 +49,7 @@ return new class() extends Migration {
|
|||||||
});
|
});
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not create table "invited_users": %s', $e->getMessage()));
|
Log::error(sprintf('Could not create table "invited_users": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ use Illuminate\Database\Schema\Blueprint;
|
|||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class() extends Migration {
|
return new class () extends Migration {
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Schema::create('audit_log_entries', function (Blueprint $table) {
|
Schema::create('audit_log_entries', function (Blueprint $table) {
|
||||||
@ -54,6 +54,7 @@ return new class() extends Migration {
|
|||||||
});
|
});
|
||||||
} catch (QueryException $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not create table "audit_log_entries": %s', $e->getMessage()));
|
Log::error(sprintf('Could not create table "audit_log_entries": %s', $e->getMessage()));
|
||||||
|
Log::error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ return new class() extends Migration {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('audit_log_entries');
|
Schema::dropIfExists('audit_log_entries');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user