Database design 这是存储简单社交媒体统计数据的正确方法吗

Database design 这是存储简单社交媒体统计数据的正确方法吗,database-design,laravel-5,eloquent,Database Design,Laravel 5,Eloquent,我试图追踪一些公司的社交媒体统计数据。在这个阶段,我主要是将他们的总受众规模存储在不同的社交媒体平台上 这种结构是实现这一目标的最佳方式还是有更有效/更好的方式 存储基本品牌信息 Schema::create('brands', function(Blueprint $table) { $table->increments('id'); $table->string('name')->unique(); $

我试图追踪一些公司的社交媒体统计数据。在这个阶段,我主要是将他们的总受众规模存储在不同的社交媒体平台上

这种结构是实现这一目标的最佳方式还是有更有效/更好的方式

存储基本品牌信息

Schema::create('brands', function(Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('slug')->nullable();
            $table->string('url')->unique();
            $table->integer('total_audience')->unsigned();
            $table->timestamps();
            $table->softDeletes();
        });
存储有关社交网络上特定帐户实例的信息

Schema::create('brandAccounts', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('brand_id')->unsigned();
            $table->foreign('brand_id')->references('id')->on('brands');
            $table->enum('network', array('facebook', 'twitter', 'instagram','youtube'));
            $table->string('network_id');
            $table->timestamps();
            $table->softDeletes();
        });
存储特定社交媒体帐户的单个数据点

    Schema::create('brandAccountLogs', function(Blueprint $table) {
        $table->increments('id');
        $table->integer('brand_account_id')->unsigned();
        $table->foreign('brand_account_id')->references('id')->on('brandAccounts');
        $table->integer('log')->unsigned();
        $table->timestamps();
        $table->softDeletes();
    });

我可能也应该在外键上放置索引。

还应该根据您希望在此数据上运行的查询类型考虑更多索引。例如,如果您想检索一个品牌追随者数量随时间变化的时间线,则需要brandAccountLogs上的索引:(brand_account_id,timestamp_created)。谢谢。我没想到在时间戳上加索引