* @param connection The connection to the SQL database.
* @param userStore The storage for User data.
* @param channelStore The storage for channels.
* @param connection The connection to the SQL database.
* @param userStore The storage for User data.
* @param channelStore The storage for channels.
*/
publicAccountStorage(Connectionconnection,
Storage<User,SQLException>userStore,
Storage<Channel,SQLException>channelStore)
throwsSQLException{
Storage<User,SQLException>userStore,
Storage<Channel,SQLException>channelStore)
throwsSQLException{
this.connection=connection;
this.userStore=userStore;
this.channelStore=channelStore;
connection.createStatement()
.executeUpdate("CREATE TABLE IF NOT EXISTS Account (id TEXT PRIMARY KEY, version TEXT, user TEXT, password TEXT, FOREIGN KEY(user) REFERENCES User(id) ON DELETE CASCADE)");
connection.createStatement()
.executeUpdate("CREATE TABLE IF NOT EXISTS AccountChannel (account TEXT, channel TEXT, alias TEXT, ordinal INTEGER, PRIMARY KEY(account,channel), FOREIGN KEY(account) REFERENCES Account(id) ON DELETE CASCADE, FOREIGN KEY(channel) REFERENCES Channel(id) ON DELETE CASCADE)");