github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/internal/datastore/mysql/migrations/tables.go (about) 1 package migrations 2 3 const ( 4 tableNamespaceDefault = "namespace_config" 5 tableTransactionDefault = "relation_tuple_transaction" 6 tableTupleDefault = "relation_tuple" 7 tableMigrationVersion = "mysql_migration_version" 8 tableMetadataDefault = "mysql_metadata" 9 tableCaveatDefault = "caveat" 10 ) 11 12 type tables struct { 13 tableMigrationVersion string 14 tableTransaction string 15 tableTuple string 16 tableNamespace string 17 tableMetadata string 18 tableCaveat string 19 } 20 21 func newTables(prefix string) *tables { 22 return &tables{ 23 tableMigrationVersion: prefix + tableMigrationVersion, 24 tableTransaction: prefix + tableTransactionDefault, 25 tableTuple: prefix + tableTupleDefault, 26 tableNamespace: prefix + tableNamespaceDefault, 27 tableMetadata: prefix + tableMetadataDefault, 28 tableCaveat: prefix + tableCaveatDefault, 29 } 30 } 31 32 func (tn *tables) migrationVersion() string { 33 return tn.tableMigrationVersion 34 } 35 36 // RelationTupleTransaction returns the prefixed transaction table name. 37 func (tn *tables) RelationTupleTransaction() string { 38 return tn.tableTransaction 39 } 40 41 // RelationTuple returns the prefixed relationship tuple table name. 42 func (tn *tables) RelationTuple() string { 43 return tn.tableTuple 44 } 45 46 // Namespace returns the prefixed namespace table name. 47 func (tn *tables) Namespace() string { 48 return tn.tableNamespace 49 } 50 51 func (tn *tables) Metadata() string { 52 return tn.tableMetadata 53 } 54 55 func (tn *tables) Caveat() string { 56 return tn.tableCaveat 57 }