> For the complete documentation index, see [llms.txt](https://android-ebook-app.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://android-ebook-app.gitbook.io/docs/migrate-from-older-version/v3.1.0-to-v4.0.0.md).

# v3.1.0 to v4.0.0

**ANDROID STUDIO**

A complete reinstallation project is required. See [**FAQ**](broken://pages/-MKnnWbOHikP12wEdYST) for more detail.

**ADMIN PANEL**

This guide is for you who want to migrate from **older version (v3.1.0)** to **latest version (v4.0.0)** without losing your previous data, but, to avoid unexpected data loss, we recommend that you backup your data before doing this step, this step is for the **admin panel** as server side.

1. Login to your cpanel hosting, open **PhpMyAdmin**
2. Select your database and make update by inserting SQL query function on below :

{% tabs %}
{% tab title="Query 1" %}

```sql
CREATE TABLE `tbl_category` (
  `cid` int(11) NOT NULL AUTO_INCREMENT,
  `category_name` varchar(255) NOT NULL,
  `category_image` varchar(255) NOT NULL,
  PRIMARY KEY (`cid`) 
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

{% endtab %}

{% tab title="Query 2" %}

```sql
INSERT INTO `tbl_category` (`cid`, `category_name`, `category_image`) 
VALUES (1, 'Uncategorized', 'uncategorized.png');
```

{% endtab %}

{% tab title="Query 3" %}

```sql
ALTER TABLE `tbl_book` 
ADD `category_id` INT NOT NULL DEFAULT '1' AFTER `book_id`;
```

{% endtab %}

{% tab title="Query 4" %}

```sql
ALTER TABLE `tbl_settings` 
ADD `package_name` VARCHAR(255) NOT NULL AFTER `story_order`, 
ADD `fcm_notification_topic` VARCHAR(255) NOT NULL 
DEFAULT 'android_ebook_app_topic' AFTER `package_name`, 
ADD `privacy_policy` TEXT NOT NULL AFTER `fcm_notification_topic`, 
ADD `more_apps_url` VARCHAR(255) NOT NULL AFTER `privacy_policy`;
```

{% endtab %}

{% tab title="Query 5" %}

```sql
CREATE TABLE `tbl_ads` (
  `id` int(11) NOT NULL,
  `ad_status` varchar(5) NOT NULL DEFAULT 'on',
  `ad_type` varchar(45) NOT NULL DEFAULT 'admob',
  `admob_publisher_id` varchar(45) NOT NULL DEFAULT '0',
  `admob_app_id` varchar(255) NOT NULL DEFAULT '0',
  `admob_banner_unit_id` varchar(255) NOT NULL DEFAULT '0',
  `admob_interstitial_unit_id` varchar(255) NOT NULL DEFAULT '0',
  `admob_native_unit_id` varchar(255) NOT NULL DEFAULT '0',
  `admob_app_open_ad_unit_id` varchar(45) NOT NULL DEFAULT '0',
  `startapp_app_id` varchar(255) NOT NULL DEFAULT '0',
  `unity_game_id` varchar(45) NOT NULL DEFAULT '0',
  `unity_banner_placement_id` varchar(45) NOT NULL DEFAULT 'banner',
  `unity_interstitial_placement_id` varchar(45) NOT NULL DEFAULT 'video',
  `applovin_banner_ad_unit_id` varchar(45) NOT NULL DEFAULT '0',
  `applovin_interstitial_ad_unit_id` varchar(45) NOT NULL DEFAULT '0',
  `mopub_banner_ad_unit_id` varchar(45) NOT NULL DEFAULT '0',
  `mopub_interstitial_ad_unit_id` varchar(45) NOT NULL DEFAULT '0',
  `interstitial_ad_interval` int(11) NOT NULL DEFAULT 3,
  `native_ad_interval` int(11) NOT NULL DEFAULT 24,
  `native_ad_index` int(11) NOT NULL DEFAULT 6
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

{% endtab %}

{% tab title="Query 6" %}

```sql
INSERT INTO `tbl_ads` (
    `id`, 
    `ad_status`, 
    `ad_type`, 
    `admob_publisher_id`, 
    `admob_app_id`, 
    `admob_banner_unit_id`, 
    `admob_interstitial_unit_id`, 
    `admob_native_unit_id`, 
    `admob_app_open_ad_unit_id`,  
    `startapp_app_id`, 
    `unity_game_id`, 
    `unity_banner_placement_id`, 
    `unity_interstitial_placement_id`, 
    `applovin_banner_ad_unit_id`, 
    `applovin_interstitial_ad_unit_id`, 
    `mopub_banner_ad_unit_id`, 
    `mopub_interstitial_ad_unit_id`, 
    `interstitial_ad_interval`,
    `native_ad_interval`, 
    `native_ad_index`
 ) 
 VALUES (
     1, 
     'on', 
     'admob', 
     'pub-3940256099942544', 
     'ca-app-pub-3940256099942544~3347511713', 
     'ca-app-pub-3940256099942544/6300978111', 
     'ca-app-pub-3940256099942544/1033173712', 
     'ca-app-pub-3940256099942544/2247696110', 
     'ca-app-pub-3940256099942544/3419835294', 
     '0', 
     '0', 
     'banner', 
     'video', 
     '0', 
     '0', 
     'b195f8dd8ded45fe847ad89ed1d016da', 
     '24534e1901884e398f1253216226017e',
     3, 
     24, 
     6
 );
```

{% endtab %}
{% endtabs %}

**Update PHP Script**

1. Login to your cpanel hosting, open **File Manager**
2. Navigate to the directory where you put the php admin panel code
3. Download [**android\_ebook\_app\_admin\_update\_v4.0.0.zip**](https://drive.google.com/file/d/1czta578hFpRZUBYA-hWqm_HhCvjaz4aT/view), upload it into your existing admin panel directory and then extract it (this update code same with admin panel code in the Codecanyon download package except upload and includes folder).
4. After the extract process is complete, refresh it
5. Your Admin Panel is ready to use. (Note : if you use Google Chrome, click **“Ctrl + F5”** to reload the Admin Panel page).
