cloudspannerecosystem/wrench

ALTER INDEX syntax is not supported

Closed this issue · 0 comments

dtest commented

Expected Behavior

Creating a migration file to ALTER INDEX should succeed as per Spanner DDL docs

Current Behavior

Fails with errors like:

Error command: up, version: unknown
        failed to parse DDL/DML statements: <file>.sql:1.0: unknown DDL statement, <file>.sql:1.0: unknown DML statement

Steps to Reproduce

  1. Start with schema file like ./schema/schema.sql:
CREATE TABLE players (
  playerUUID STRING(36) NOT NULL,
  player_name STRING(64) NOT NULL,
  email STRING(MAX) NOT NULL,
  password_hash BYTES(60) NOT NULL,  
  is_logged_in BOOL,
) PRIMARY KEY(playerUUID);

CREATE UNIQUE INDEX PlayerAuthentication ON players(email) STORING (password_hash);
  1. Create the database using wrench:
wrench create --directory ./schema
  1. Create a new migration file
wrench migrate create --directory ./schema

# cat ./schema/migrations/000001.sql
ALTER INDEX PlayerAuthentication ADD STORED COLUMN is_logged_in;

  1. Run migration:
wrench migrate up --directory ./schema

Context (Environment)

  • wrench version: 1.3.3

The workaround is to drop index and recreate. But it'd be nice to have ALTER INDEX supported.