github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/datastore/spanner/migrations/zz_migration.0005_drop_changelog_table.go (about)

     1  package migrations
     2  
     3  import (
     4  	"context"
     5  
     6  	"cloud.google.com/go/spanner/admin/database/apiv1/databasepb"
     7  )
     8  
     9  var dropChangelogTable = `DROP TABLE changelog`
    10  
    11  func init() {
    12  	if err := SpannerMigrations.Register("drop-changelog-table", "register-tuple-change-stream", func(ctx context.Context, w Wrapper) error {
    13  		updateOp, err := w.adminClient.UpdateDatabaseDdl(ctx, &databasepb.UpdateDatabaseDdlRequest{
    14  			Database: w.client.DatabaseName(),
    15  			Statements: []string{
    16  				dropChangelogTable,
    17  			},
    18  		})
    19  		if err != nil {
    20  			return err
    21  		}
    22  		return updateOp.Wait(ctx)
    23  	}, nil); err != nil {
    24  		panic("failed to register migration: " + err.Error())
    25  	}
    26  }