singlestore-labs / singlestoredb-laravel-driver

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

Can't rename columns and indexes #63

Closed larskoole closed 1 year ago

larskoole commented 1 year ago

I'm trying to rename some columns and indexes but I'm running into some issue.

When trying to rename a column:

SQLSTATE[HY000]: General error: 1706 Feature 'ALTER TABLE CHANGE to modify column type' is not supported by SingleStore. Use MODIFY to change a column's type. (Connection: singlestore, SQL: ALTER TABLE product_attribute_options CHANGE attribute_value_id attribute_option_id CHAR(26) NOT NULL)
Schema::table('product_attribute_options', function (Blueprint $table) {
    $table->renameColumn('attribute_value_id', 'attribute_option_id');
});

When trying to rename an index:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index `order_line_warehouse_storage_location_reservations_primary` to `order_lin' at line 1 (Connection: singlestore, SQL: alter table `order_line_storage_location_reservations` rename index `order_line_warehouse_storage_location_reservations_primary` to `order_line_storage_location_reservations_primary`)
Schema::table('order_line_storage_location_reservations', function (Blueprint $table) {
    $table->renameIndex('order_line_warehouse_storage_location_reservations_primary', 'order_line_storage_location_reservations_primary');
});

I'm pretty sure SingleStore is able to rename columns. Not sure about indexes. (https://docs.singlestore.com/cloud/reference/sql-reference/data-definition-language-ddl/alter-table/)

AdalbertMemSQL commented 1 year ago

Hey @larskoole Thanks for reaching out. I created an internal ticket to fix this.

AdalbertMemSQL commented 1 year ago

Hey @larskoole This pull request https://github.com/singlestore-labs/singlestoredb-laravel-driver/pull/65 should fix column renaming. Regarding index renaming - it is not supported in SingleStore. I will create a feature request to add this possibility to the database.

larskoole commented 1 year ago

Thanks for fixing it!