Upgrading Mixpost Enterprise to v4 from v3
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
. - Add Reverb environment variables.
- Execute these commands:
# Pull the latest version
docker compose pull
# Stop and remove the old container
docker compose down
# Start a new container
docker compose up -d
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 "^4.0" -W
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\Schema;
use Illuminate\Support\Facades\DB;
use Inovector\Mixpost\Enums\WorkspaceUserRole;
return new class extends Migration {
public function up()
{
if (Schema::hasTable('mixpost_workspace_user')) {
if (!Schema::hasColumn('mixpost_workspace_user', 'can_approve')) {
Schema::table('mixpost_workspace_user', function (Blueprint $table) {
$table->boolean('can_approve')->default(false);
});
}
}
if (!Schema::hasTable('mixpost_post_activities')) {
Schema::create('mixpost_post_activities', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
$table->foreignId('post_id')->constrained('mixpost_posts')->onDelete('cascade');
$table->bigInteger('user_id'); // 0 for system
$table->bigInteger('parent_id')->nullable()->constrained('mixpost_post_activities')->onDelete('cascade');
$table->tinyInteger('type');
$table->json('data')->nullable();
$table->longText('text')->nullable(); // for comments
$table->timestamps();
});
}
if (!Schema::hasTable('mixpost_post_activity_reactions')) {
Schema::create('mixpost_post_activity_reactions', function (Blueprint $table) {
$table->id();
$table->foreignId('activity_id')->constrained('mixpost_post_activities')->onDelete('cascade');
$table->bigInteger('user_id')->unsigned();
$table->string('reaction');
$table->timestamps();
});
}
if (!Schema::hasTable('mixpost_post_activities_ns')) {
Schema::create('mixpost_post_activities_ns', function (Blueprint $table) {
$table->id();
$table->foreignId('post_id')->constrained('mixpost_posts')->onDelete('cascade');
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->timestamps();
});
}
if (Schema::hasTable('mixpost_e_invitations')) {
if (!Schema::hasColumn('mixpost_e_invitations', 'can_approve')) {
Schema::table('mixpost_e_invitations', function (Blueprint $table) {
$table->boolean('can_approve')->default(false);
});
}
}
DB::table('mixpost_workspace_user')
->where('role', WorkspaceUserRole::ADMIN->value)
->update(['can_approve' => true]);
}
};
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_v4_tables
- Open the new migration file from
database/migrations
and paste the migration code into it. - Apply the migration with:
php artisan migrate
- Done!
3. Config changes
If you have published the Mixpost config file, you should update it manually.
To update easily, simply run the following command:
php artisan vendor:publish --tag=mixpost-config --force
4. Add new broadcast routes
In the app/Providers/AppServiceProvider.php
file, add the Mixpost broadcast routes within the boot
method as follows:
public function boot(): void
{
// ...
\Inovector\Mixpost\Broadcast::routes();
}
5. Clear the cache
php artisan route:clear
php artisan view:clear
php artisan mixpost:clear-services-cache
php artisan mixpost:clear-settings-cache
6. Optimize application
php artisan optimize
7. Restart Reverb
If reverb
is set as your BROADCAST_DRIVER
, ensure you restart it to apply changes. Otherwise, you can skip this step.
8. Terminate the Horizon process
php artisan horizon:terminate
Conclusion
Following these steps will ensure that your Mixpost Enterprise installation is upgraded to v4
, maintaining performance and security standards.