I'm trying to track really simple social media stats for some companies. At this stage I'm largely storing just their total audience size on different social media platforms.
Is this structure the best way to do this or is there a more efficient/better way?
Stores the base brand infomation
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();
});
Stores information about specific instances of accounts on social networks
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();
});
Stores individual data points for specific social media accounts.
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();
});
I should probably put indexes on the foreign keys too.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community