Skip to content
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

feature(spanner): Implement DML Support for Spanner #1197

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jtwatson
Copy link

@jtwatson jtwatson commented Nov 29, 2024

Closes #135
Closes #775
Closes #918
Closes #1194

Supersedes the following PRs #733, #910, #924

  1. This PR implements DML support and uses the memefish lexer to parse the migrations, replacing the usage of the spansql package. As a result, numerous other spansql related issues have been resolved.

    The following features have been implemented:

    1. DML support
    2. Ability to put multiple statements in a single migration script
    3. Ability to include comments in the migration scripts
    4. Ability to mix DDL and DML in the same migration script

    To maintain backward compatibility, the x-clean-statements option must be used to enable the above features.

  2. This PR also fixes a bug where a provided spanner client via WithInstance() is closed when Migration.Close() is called. According to Docs, the caller is responsible for closing the underlying database client. This fix brings the Spanner driver into compliance with the expected behavior.

I am maintaining a fork with this fix for those who would like to use it.

Put the following replace directive you your projects go.mod

replace github.com/golang-migrate/migrate/v4 v4.18.1 => github.com/jtwatson/migrate/v4 v4.18.2-beta.2

@jtwatson jtwatson force-pushed the feature/spanner-client-enhancements branch from c60aa87 to be12225 Compare November 29, 2024 06:35
@jtwatson jtwatson changed the title feature: Implement DML Support for Spanner feature(spanner): Implement DML Support for Spanner Nov 29, 2024
@jtwatson
Copy link
Author

jtwatson commented Nov 29, 2024

@dhui

This PR supersedes the following PR #733, #910, #924

It is a robust implementation that greatly improves support for Spanner migrations. It also fixes a lot of open issues with the existing DDL parsing implementation.

NOTE: Not sure why tests are failing, but it is not related to spanner tests. It looks like cockroachdb is having an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant