Skip to content

Commit 42bddb0

Browse files
committed
version 1.0
1 parent 39c94ea commit 42bddb0

File tree

7 files changed

+556
-2
lines changed

7 files changed

+556
-2
lines changed

README.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
1-
# oc-database-compare
2-
Database compare tool for OpenCart (Version 4.x.x)
1+
<p align="center">
2+
<a href="https://php.net/"><img src="https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg?style=flat-square"></a>
3+
<a href="https://github.com/opencart/opencart"><img src="http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat"></a>
4+
</p>
5+
6+
# opencart database compare
7+
8+
![Opencart logo](https://www.opencart.com/application/view/image/icon/opencart-logo.png)
9+
10+
**OC database compare** is a tool to help admins and developers check **Opencart's** database schema changes during website development. This schema change can be caused by the developers themselves or by the extensions they install.
11+
12+
> * PHP : 8+
13+
> * Opencart : 4.x.x
14+
15+
## User manual
16+
17+
### Install
18+
19+
`-` clone the whole source from git to your machine
20+
21+
`-` copy and **merge** the **admin** folder with your admin folder
22+
23+
### Using
24+
25+
`-` Access the following route :
26+
27+
**https://your_admin_url/index.php?route=tool/migrate**
28+
29+
You will see the database schema changes statistics interface
30+
31+
![OC database compare](doc/db.png)
32+
33+
34+
35+
# License
36+
37+
`-` **OC database compare** is released under the MIT license. [See LICENSE](LICENSE) for details.
38+
39+
`-` **OC database compare** is useful for you? Please consider donating to sustain our activities ? Please consider [donating](https://www.paypal.me/lequang1988) to sustain my activities.
40+
<p align="center">
41+
<a href="https://www.paypal.me/lequang1988"><img width="100px" src="doc/donate.png"></a>
42+
</p>
43+

admin/controller/tool/migrate.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
namespace Opencart\Admin\Controller\Tool;
3+
4+
class Migrate extends \Opencart\System\Engine\Controller
5+
{
6+
public function index(): void {
7+
$this->load->language('tool/migrate');
8+
$this->document->setTitle($this->language->get('heading_title'));
9+
10+
$data['breadcrumbs'] = [];
11+
12+
$data['breadcrumbs'][] = [
13+
'text' => $this->language->get('text_home'),
14+
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'])
15+
];
16+
17+
$data['breadcrumbs'][] = [
18+
'text' => $this->language->get('heading_title'),
19+
'href' => $this->url->link('tool/migrate', 'user_token=' . $this->session->data['user_token'])
20+
];
21+
22+
$data['user_token'] = $this->session->data['user_token'];
23+
$this->load->model('tool/migrate');
24+
25+
$data['header'] = $this->load->controller('common/header');
26+
$data['column_left'] = $this->load->controller('common/column_left');
27+
$data['footer'] = $this->load->controller('common/footer');
28+
29+
$this->response->setOutput($this->load->view('tool/migrate', $data));
30+
}
31+
32+
public function getListMigrate():void {
33+
$this->load->model('tool/migrate');
34+
$data = $this->model_tool_migrate->migrateDBScheme();
35+
$this->response->addHeader('Content-Type: application/json');
36+
$this->response->setOutput(json_encode($data));
37+
}
38+
}

admin/language/en-gb/tool/migrate.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
$_['heading_title'] = 'Migrate Database';
4+
$_['column_tb'] = 'Table name';
5+
$_['column_type'] = 'Type';
6+
$_['column_content'] = 'Content';
7+
$_['btn_content'] = 'Show change';
8+
$_['type_add'] = 'New';
9+
$_['type_edit'] = 'Edit';
10+
$_['type_add_field'] = 'New field';
11+
$_['type_edit_field'] = 'Edit field';
12+
$_['type_edit_index'] = 'Edit index';
13+
$_['type_remove'] = 'Remove';

0 commit comments

Comments
 (0)