Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
commerce_exchanger
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
commerce_exchanger
Commits
d0ef7e45
Commit
d0ef7e45
authored
1 year ago
by
Valentino Međimorec
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3393574
by Andrew.Macpherson, valic: Status Report Error: Transaction isolation level
parent
78d07a0c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#30308
passed with warnings
1 year ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
commerce_exchanger.install
+74
-0
74 additions, 0 deletions
commerce_exchanger.install
with
74 additions
and
0 deletions
commerce_exchanger.install
+
74
−
0
View file @
d0ef7e45
...
...
@@ -66,6 +66,66 @@ function commerce_exchanger_update_10002(&$sandbox) {
}
}
/**
* Implements hook_update_N().
*/
function
commerce_exchanger_update_10003
(
&
$sandbox
)
{
$database
=
\Drupal
::
database
();
$definitions
=
commerce_exchanger_schema
();
$schema
=
$database
->
schema
();
foreach
(
$definitions
as
$table
=>
$definition
)
{
// Pull values.
$values
=
$database
->
select
(
$table
,
't'
)
->
fields
(
't'
)
->
execute
()
->
fetchAll
();
// Make a backup table.
$schema
->
renameTable
(
$table
,
$table
.
'_backup'
);
// Recreate table
$schema
->
createTable
(
$table
,
$definition
);
$fields
=
[
'exchanger'
,
'source'
,
'target'
,
'value'
,
'manual'
,
];
if
(
$table
===
'commerce_exchanger_latest_rates'
)
{
$fields
[]
=
'timestamp'
;
}
else
{
$fields
[]
=
'date'
;
}
// Re-insert values.
$query
=
$database
->
insert
(
$table
)
->
fields
(
$fields
);
foreach
(
$values
as
$value
)
{
$items
=
[
'exchanger'
=>
$value
->
exchanger
,
'source'
=>
$value
->
source
,
'target'
=>
$value
->
target
,
'value'
=>
$value
->
value
,
'manual'
=>
$value
->
manual
,
];
if
(
$table
===
'commerce_exchanger_latest_rates'
)
{
$items
[
'timestamp'
]
=
$value
->
timestamp
;
}
else
{
$items
[
'date'
]
=
$value
->
date
;
}
$query
->
values
(
$items
);
}
$query
->
execute
();
// Remove backup table.
$schema
->
dropTable
(
$table
.
'_backup'
);
}
}
/**
* Implements hook_schema().
*/
...
...
@@ -73,6 +133,12 @@ function commerce_exchanger_schema() {
$schema
[
'commerce_exchanger_latest_rates'
]
=
[
'description'
=>
'Stores latest exchange rates.'
,
'fields'
=>
[
'id'
=>
[
'type'
=>
'serial'
,
'unsigned'
=>
TRUE
,
'not null'
=>
TRUE
,
'description'
=>
'Primary Key: ID.'
,
],
'exchanger'
=>
[
'description'
=>
'The commerce exchanger plugin'
,
'type'
=>
'varchar'
,
...
...
@@ -112,6 +178,7 @@ function commerce_exchanger_schema() {
'default'
=>
0
,
],
],
'primary key'
=>
[
'id'
],
'indexes'
=>
[
'plugin_currency'
=>
[
'exchanger'
,
'source'
,
'target'
],
],
...
...
@@ -119,6 +186,12 @@ function commerce_exchanger_schema() {
$schema
[
'commerce_exchanger_historical_rates'
]
=
[
'description'
=>
'Stores latest exchange rates.'
,
'fields'
=>
[
'id'
=>
[
'type'
=>
'serial'
,
'unsigned'
=>
TRUE
,
'not null'
=>
TRUE
,
'description'
=>
'Primary Key: ID.'
,
],
'exchanger'
=>
[
'description'
=>
'The commerce exchanger plugin'
,
'type'
=>
'varchar'
,
...
...
@@ -157,6 +230,7 @@ function commerce_exchanger_schema() {
'length'
=>
20
,
],
],
'primary key'
=>
[
'id'
],
'indexes'
=>
[
'plugin_currency'
=>
[
'exchanger'
,
'source'
,
'target'
],
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment