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

     1  package migrations
     2  
     3  import "fmt"
     4  
     5  // Extend the object ID column to 1024 characters
     6  func adjustObjectIDLength(t *tables) string {
     7  	return fmt.Sprintf(
     8  		`ALTER TABLE %s
     9  		CONVERT TO CHARACTER SET latin1,
    10  		MODIFY object_id VARCHAR(1024) NOT NULL,
    11  		MODIFY userset_object_id VARCHAR(1024) NOT NULL;`,
    12  		t.RelationTuple(),
    13  	)
    14  }
    15  
    16  func init() {
    17  	mustRegisterMigration("extend_object_id", "add_caveat", noNonatomicMigration,
    18  		newStatementBatch(
    19  			adjustObjectIDLength,
    20  		).execute,
    21  	)
    22  }