cloudspannerecosystem / wrench

wrench - Schema management tool for Cloud Spanner -
MIT License
238 stars 47 forks source link

Unable to perform migration using GENERATE_UUID() #100

Closed tomopy03 closed 8 months ago

tomopy03 commented 10 months ago

Expected Behavior

Creating a migration file using GENERATE_UUID() should be successful. The use of GENERATE_UUID() should be available. https://cloud.google.com/spanner/docs/primary-key-default-value#universally_unique_identifier_uuid

Current Behavior

Fails with errors like:

Error command: up, version: 1.6.0
        failed to parse DDL/DML statements: 000001.sql:2: got "(" while expecting ")", 000001.sql:1.0: unknown DML statement

Steps to Reproduce

  1. Create the database using wrench:
    wrench create --directory ./schema
  2. Create a new migration file:
    
    wrench migrate create --directory ./schema

cat ./schema/migrations/000001.sql

CREATE TABLE test ( test_id STRING(36) NOT NULL DEFAULT (GENERATE_UUID()) );

3. Run migration:

wrench migrate up --directory ./schema



## Context (Environment)

* wrench version: 1.6.0

<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
tomopy03 commented 8 months ago

Solved to v1.7.0. Thank you for updated!