mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-06 00:08:41 +00:00
prepare for currency table
This commit is contained in:
parent
6bbe3f8f6f
commit
083ff79109
|
|
@ -51,9 +51,9 @@
|
|||
"type": "VARCHAR(100)",
|
||||
"null": false
|
||||
},
|
||||
"currency_num": {
|
||||
"name": "currency_num",
|
||||
"type": "VARCHAR(3)",
|
||||
"currency_number": {
|
||||
"name": "currency_number",
|
||||
"type": "SMALLINT(4)",
|
||||
"null": false
|
||||
},
|
||||
"currency_symbol": {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ final class Installer extends InstallerAbstract
|
|||
]);
|
||||
|
||||
self::installLanguages($sqlite, $dbPool);
|
||||
self::installCurrencies($sqlite, $dbPool);
|
||||
|
||||
$sqlite->close();
|
||||
}
|
||||
|
|
@ -83,4 +84,42 @@ final class Installer extends InstallerAbstract
|
|||
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install currencies
|
||||
*
|
||||
* @param SQLiteConnection $sqlite SQLLite database connection of the source data
|
||||
* @param DatabasePool $dbPool Database pool to save data to
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function installCurrencies(SQLiteConnection $sqlite, DatabasePool $dbPool) : void
|
||||
{
|
||||
$con = $dbPool->get();
|
||||
|
||||
$query = new Builder($con);
|
||||
$query->prefix($con->getPrefix())
|
||||
->insert('currency_id', 'currency_name', 'currency_char', 'currency_number', 'currency_symbol', 'currency_subunits', 'currency_decimals', 'currency_countries')
|
||||
->into('currency');
|
||||
|
||||
$querySqlite = new Builder($sqlite);
|
||||
$currencies = $querySqlite->select('*')->from('currency')->execute();
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
$query->values(
|
||||
$currency['currency_id'],
|
||||
$currency['currency_name'],
|
||||
$currency['currency_char'],
|
||||
$currency['currency_number'],
|
||||
$currency['currency_symbol'],
|
||||
$currency['currency_subunits'],
|
||||
$currency['currency_decimals'],
|
||||
$currency['currency_countries']
|
||||
);
|
||||
}
|
||||
|
||||
$query->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user