Skip to main content

Upgrading Mixpost Enterprise to v3 from v2

Backup database

Sometimes the upgrade can go wrong, so we recommend that you backup your database before starting the upgrade.

Upgrade Using Docker

Upgrading Mixpost using Docker is straightforward. Ensure that you preserve the mounted volume during the process. Simply follow these steps:

Navigate to your folder where you have the docker-compose.yml the file then run:

# Pull the latest version
docker compose pull

# Stop and remove the old container
docker compose down

# Start a new container
docker compose up -d
info

If something goes wrong, you can use the inovector/mixpost-enterprise:v2 tag to revert. Also, you need to restore your database backup.

Upgrade in a PHP Environment

This method applies if you have installed Mixpost Enterprise manually or within an existing Laravel application.

1. Updating your composer.json using the require command

composer require inovector/mixpost-enterprise "^3.0" --with-all-dependencies

2. Migrations

Some changes were made to the database, use the migration below to update your database to the latest schema:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up()
{
Schema::table('mixpost_e_receipts', function (Blueprint $table) {
if(Schema::hasIndex('mixpost_e_receipts', ['workspace_id', 'order_id'], 'unique')) {
Schema::table('mixpost_e_receipts', function (Blueprint $table) {
$table->dropUnique(['workspace_id', 'order_id']);
});
}

if(Schema::hasColumn('mixpost_e_receipts', 'checkout_id')) {
$table->renameColumn('checkout_id', 'transaction_id');
}

if(Schema::hasColumn('mixpost_e_receipts', 'order_id')) {
$table->renameColumn('order_id', 'invoice_number');
}

if(!Schema::hasIndex('mixpost_e_receipts', ['invoice_number'], 'unique')) {
$table->unique('invoice_number');
}

if(!Schema::hasIndex('mixpost_e_receipts', ['workspace_id', 'invoice_number'])) {
$table->index(['workspace_id', 'invoice_number']);
}
});

if (!Schema::hasTable('mixpost_e_customers')) {
Schema::create('mixpost_e_customers', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->index();
$table->string('platform_customer_id')->unique();
$table->timestamps();
});
}

DB::table('users')->whereNull('email_verified_at')->update(['email_verified_at' => now()]);
}
};

Don't know how to migrate?

  • Open your terminal and navigate to your project directory.
  • Generate a migration file by running: php artisan make:migration create_mixpost_v3_tables
  • Open the new migration file from database/migrations and paste the migration code into it.
  • Apply the migration with: php artisan migrate
  • Done!
danger

This migration will set email_verified_at column to now() for all users. If you do not want this, please remove this line:

DB::table('users')->whereNull('email_verified_at')->update(['email_verified_at' => now()]);

3. Clear the cache

php artisan route:clear
php artisan view:clear
php artisan mixpost:clear-services-cache
php artisan mixpost:clear-settings-cache

4. Optimize application

php artisan optimize

5. Terminate the Horizon process

php artisan horizon:terminate

Conclusion

Following these steps will ensure that your Mixpost Enterprise installation is upgraded to v3, maintaining performance and security standards.