singlestore-labs / singlestoredb-laravel-driver

The official SingleStore Laravel driver.
https://github.com/singlestore-labs/singlestore-laravel-driver
Apache License 2.0
224 stars 22 forks source link

add: compilePrimary function to src/Schema/Grammar.php #52

Closed nickarellano closed 1 year ago

nickarellano commented 1 year ago

There was a PR that was accepted for laravel/framework:v9.47.0 that breaks primary keys with SingleStore.

[9.x] Remove index name when adding primary key on MySQL #45515

Expected query:

create rowstore table `cache` (
  `key` text not null,
  `value` text not null,
  `expiration` int not null,
  shard key(`key`),
  primary key (`key`)
) default character set utf8mb4 collate 'utf8mb4_unicode_ci'

Actual problematic query:

create rowstore table `cache` (
  `key` text not null,
  `value` text not null,
  `expiration` int not null,
  shard key(`key`),
  alter table
    `cache`
  add
    primary key (`key`)
) default character set utf8mb4 collate 'utf8mb4_unicode_ci'
carlsverre commented 1 year ago

Thanks for the quick fix!