Witam,
Nie wiem czy dokładnie o to Ci chodzi, ale ta schema może być zdefiniowana między innymi w ten sposób:
User:
actAs: { Timestampable: ~ }
columns:
id { type: integer(4), autoincrement: true, primary: true }
nickname: { type: string(255), notnull: true, unique: true }
created_at: { type: timestamp, notnull: true }
relations:
PlayerCities:
class: City #nazwa klasy z którą rekord ma się łączyć (jeśli inna niż nazwa)
refClass: Player #nazwa klasy przez którą następuje złączenie (dla relacji typu "many")
local: user_id #pole w relacji podanej w refClass
foreign: city_id #pole w relacji podanej w refClass
type: many
GameState:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
City:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
game_state: { type: integer, notnull: true }
created_by: { type: integer, notnull: true }
created_at: { type: timestamp, notnull: true }
relations:
MafiaGameState: { class: GameState, local: game_state, foreign: id, foreignAlias: Cites }
MafiaUser: { class: User, local: created_by, foreign: id, foreignAlias: CreatedCites }
PlayingUsers: { class: User, refClass: Player, local: city_id, foreign: user_id, type: many }
Player:
actAs: { Timestampable: ~ }
columns:
user_id: { type: integer, notnull: true }
city_id: { type: integer, notnull: true }
is_city_mayor: { type: boolean, notnull: true, default: 0 }
relations:
User: { class: User, local: user_id, foreign: id, foreignAlias: Players }
City: { class: City, local: city_id, foreign: id, foreignAlias: Players }
Mam nadzieje że Ci to pomoże.
Pozdrawiam