- Created separate MoneyFlix project directory - Copied Node.js redirector from production server - Added CRM PHP code (Redirects module, Core classes, Config, Routes, Views) - Created comprehensive documentation (README_MONEYFLIX.md) - Added sync script to keep CRM code updated (sync-from-crm.sh) - Configured .gitignore for Node.js and PHP - Set up proper project structure for multi-client isolation This separates MoneyFlix from the main CRM to avoid confusion between different client systems and provides a dedicated environment for MoneyFlix-specific development and maintenance.
40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Core\Database\Migrations;
|
|
|
|
use App\Core\Database\Migration;
|
|
|
|
class CreateAnalyticsDailyTable extends Migration
|
|
{
|
|
/**
|
|
* The name of the database connection to use.
|
|
* Uses default CRM database for analytics data
|
|
*/
|
|
protected ?string $connection = null; // CRM database (default)
|
|
|
|
public function up(): void
|
|
{
|
|
$this->createTable('analytics_daily', function($table) {
|
|
$table->bigInteger('id')->autoIncrement()->notNull()
|
|
->integer('page_views')->default(0)->notNull()->comment('Daily page views')
|
|
->integer('unique_visitors')->default(0)->notNull()->comment('Daily unique visitors')
|
|
->decimal('bounce_rate', 5, 2)->default(0.00)->notNull()->comment('Daily bounce rate percentage')
|
|
->decimal('avg_session_duration', 8, 2)->default(0.00)->notNull()->comment('Average session duration in minutes')
|
|
->date('date')->notNull()->comment('Date for this analytics record')
|
|
->tinyInteger('status')->default(1)->notNull()->comment('0=inactive, 1=active, -1=deleted')
|
|
->timestamp('created_at')->default('CURRENT_TIMESTAMP')->notNull()
|
|
->timestamp('updated_at')->default('CURRENT_TIMESTAMP')->notNull()
|
|
->primaryKey('id')
|
|
->index('date')
|
|
->index('status')
|
|
->unique('date'); // One record per date
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->dropTable('analytics_daily');
|
|
}
|
|
}
|