-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking changes on composite primary keys containing NULL #69
Comments
Hey @larskoole
|
I'm impressed that it was possible to create a nullable column which is a part of the primary key. |
Hah lol, I have no idea why it worked but it did make the dev experience amazing (thinking uniqueness was being enforced with a nullable column). The production and staging environment are both on SingleStore Cloud in the same workspace (saving costs). I have no idea what the version is but this is the next pending update: The local DB is version 8.1.1 using https://github.com/singlestore-labs/singlestoredb-dev-image Is there a way to recall what query was used to create a table? <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('integration_product_media', function (Blueprint $table) {
$table->ulid('product_id');
$table->ulid('media_id');
$table->ulid('integration_id')->nullable();
$table->primary([
'product_id',
'media_id',
'integration_id',
], 'integration_product_media_primary');
$table->sortKey([
'product_id',
'integration_id',
'sort_order',
]);
});
}
}; On another note: do you have a suggestion on how to enforce uniqueness without relying on locks or "wonky" solutions like https://usefathom.com/laravel-tips/multiple-uniques-singlestore? |
Btw, another weird thing is that |
To check, what query is used to create a table, you can run this
|
(ignore the random sort_order column) |
Hmm... |
Hey we've got this weird issue where migrations don't create composite primary keys the same way they used to. We used to be able to migrate nullable primary keys but now they don't get created correctly anymore.
Our production table on SingleStore Cloud:
Our staging and local table:
Our migration (which hasn't changed):
This is the case for all our pivot tables which have a
nullable
column.I'm suspecting the driver because the local environment hasn't been updated in months and still experienced this change/issue.
Production isn't impacted (for now) but having to manually run queries to fix the columns every time we use
migrate:fresh
kinda sucks. Let met know if you need more info to debug.The text was updated successfully, but these errors were encountered: