Question Regarding Shard Keys #53
-
I have a table defined like this in Laravel Schema::create('user_mails', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->string('template_id');
$table->longText('data');
$table->string('response_status_code');
$table->longText('response_message');
$table->timestamps();
}); I want to add a shardkey on the 'user_id' column So I added this after the timestamps as per the docs
I get the following error
My Question is, what would the correct way to add these shard keys be? I can do it directly in singlestore using
And this works however I need to map this to a migration file Would this be the correct solution?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It seems like the correct answer is something like this: $table->bigIncrements('id')->withoutPrimaryKey()->index();
$table->unsignedBigInteger('user_id')->shardKey();
$table->string('template_id');
$table->longText('data');
$table->string('response_status_code');
$table->longText('response_message');
$table->timestamps(); Added as a test for future reference: |
Beta Was this translation helpful? Give feedback.
It seems like the correct answer is something like this:
Added as a test for future reference:
e6fd63b#diff-f6da6c22d5e74ab81179bda2693633c2fb36619a61c3d97f857875f906c8fa1bR59