CREATE TABLE silas_stories.Cronjob (id INT AUTO_INCREMENT NOT NULL, intervalInMinutes INT NOT NULL, lastRun DATETIME NOT NULL, className LONGTEXT NOT NULL, lastSuccess DATETIME NOT NULL, errorMessage LONGTEXT NOT NULL, active TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, discr VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Code (id INT AUTO_INCREMENT NOT NULL, code VARCHAR(255) NOT NULL, creationDate DATETIME NOT NULL, isCacheable TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, discriminator VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_7B6C519377153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.UserCode (id INT NOT NULL, userId INT DEFAULT NULL, INDEX IDX_18054F5564B64DCC (userId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.ChangeEmailCode (id INT NOT NULL, newEmail VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.User (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, password VARCHAR(128) NOT NULL, email VARCHAR(255) NOT NULL, activated TINYINT(1) NOT NULL, blocked TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, UNIQUE INDEX UNIQ_81EAB742F85E0677 (username), UNIQUE INDEX UNIQ_81EAB742E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE UserAccess (UserId INT NOT NULL, AccessId INT NOT NULL, INDEX IDX_26623A76631A48FA (UserId), INDEX IDX_26623A76A1A046DD (AccessId), PRIMARY KEY(UserId, AccessId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Role (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(75) NOT NULL, beschreibung VARCHAR(255) NOT NULL, version INT DEFAULT 1 NOT NULL, UNIQUE INDEX UNIQ_5B10EB615E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE RoleUser (RoleId INT NOT NULL, UserId INT NOT NULL, INDEX IDX_2DDE86A9BF6EF8BE (RoleId), INDEX IDX_2DDE86A9631A48FA (UserId), PRIMARY KEY(RoleId, UserId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE RoleAccess (RoleId INT NOT NULL, AccessId INT NOT NULL, INDEX IDX_337C2901BF6EF8BE (RoleId), INDEX IDX_337C2901A1A046DD (AccessId), PRIMARY KEY(RoleId, AccessId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE RoleChildren (ParentId INT NOT NULL, ChildId INT NOT NULL, INDEX IDX_88554C92E9982EB8 (ParentId), INDEX IDX_88554C92CD4052DB (ChildId), PRIMARY KEY(ParentId, ChildId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.RegistrationCode (id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.RequestNewPasswordCode (id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.UserSetting (id INT AUTO_INCREMENT NOT NULL, userId INT NOT NULL, name VARCHAR(255) NOT NULL, value LONGTEXT NOT NULL, lastUpdated BIGINT NOT NULL, version INT DEFAULT 1 NOT NULL, INDEX IDX_B313C8B964B64DCC (userId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Access (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(75) NOT NULL, beschreibung VARCHAR(255) NOT NULL, version INT DEFAULT 1 NOT NULL, UNIQUE INDEX UNIQ_DF28AF285E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.ConditionObject (id INT AUTO_INCREMENT NOT NULL, version INT DEFAULT 1 NOT NULL, discriminator VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Answer (id INT NOT NULL, preconditionId INT DEFAULT NULL, messageId INT DEFAULT NULL, sequenceId INT DEFAULT NULL, INDEX IDX_39CCE5928804049 (preconditionId), UNIQUE INDEX UNIQ_39CCE59A4C3A0DA (messageId), INDEX IDX_39CCE59447AAB6A (sequenceId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE NextSequences (AnswerId INT NOT NULL, SequenceId INT NOT NULL, INDEX IDX_90B57044AD318310 (AnswerId), INDEX IDX_90B57044B27A8BA (SequenceId), PRIMARY KEY(AnswerId, SequenceId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Chat (id INT AUTO_INCREMENT NOT NULL, description LONGTEXT NOT NULL, name LONGTEXT NOT NULL, imgPath LONGTEXT NOT NULL, version INT DEFAULT 1 NOT NULL, storyId INT DEFAULT NULL, INDEX IDX_69E493A13A4FD046 (storyId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE ChatAuthors (chatId INT NOT NULL, authorId INT NOT NULL, INDEX IDX_59C24CB82DE6E13C (chatId), INDEX IDX_59C24CB8A196F9FD (authorId), PRIMARY KEY(chatId, authorId)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Precondition (id INT NOT NULL, conditionOneId INT DEFAULT NULL, conditionTwoId INT DEFAULT NULL, INDEX IDX_CB6157FDD1C549 (conditionOneId), INDEX IDX_CB6157F3A67FE19 (conditionTwoId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Sequence (id INT NOT NULL, storyId INT DEFAULT NULL, preconditionId INT DEFAULT NULL, INDEX IDX_3BD97FA93A4FD046 (storyId), INDEX IDX_3BD97FA928804049 (preconditionId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.SequencePlayed (id INT AUTO_INCREMENT NOT NULL, startDate DATETIME NOT NULL, endDate DATETIME NULL, version INT DEFAULT 1 NOT NULL, runId INT DEFAULT NULL, sequenceId INT DEFAULT NULL, answerId INT DEFAULT NULL, INDEX IDX_5D92015830FCA33B (runId), INDEX IDX_5D920158447AAB6A (sequenceId), INDEX IDX_5D9201585447E146 (answerId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Message (id INT AUTO_INCREMENT NOT NULL, message LONGTEXT NOT NULL, orderIndex INT NOT NULL, timeOffset INT NOT NULL, atTime INT NOT NULL, version INT DEFAULT 1 NOT NULL, sequenceId INT DEFAULT NULL, chatId INT DEFAULT NULL, authorId INT DEFAULT NULL, INDEX IDX_EFD74CEC447AAB6A (sequenceId), INDEX IDX_EFD74CEC2DE6E13C (chatId), INDEX IDX_EFD74CECA196F9FD (authorId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Story (id INT AUTO_INCREMENT NOT NULL, name LONGTEXT NOT NULL, imgPath LONGTEXT NOT NULL, version INT DEFAULT 1 NOT NULL, startSequenceId INT DEFAULT NULL, UNIQUE INDEX UNIQ_7C88A4D18E737261 (startSequenceId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Run (id INT AUTO_INCREMENT NOT NULL, startDate DATETIME NOT NULL, version INT DEFAULT 1 NOT NULL, userId INT DEFAULT NULL, storyId INT DEFAULT NULL, INDEX IDX_9F0C970B64B64DCC (userId), INDEX IDX_9F0C970B3A4FD046 (storyId), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     CREATE TABLE silas_stories.Author (id INT AUTO_INCREMENT NOT NULL, description LONGTEXT NOT NULL, name LONGTEXT NOT NULL, imgPath LONGTEXT NOT NULL, isUser TINYINT(1) NOT NULL, version INT DEFAULT 1 NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
     ALTER TABLE silas_stories.UserCode ADD CONSTRAINT FK_18054F5564B64DCC FOREIGN KEY (userId) REFERENCES silas_stories.User (id);
     ALTER TABLE silas_stories.UserCode ADD CONSTRAINT FK_18054F55BF396750 FOREIGN KEY (id) REFERENCES silas_stories.Code (id) ON DELETE CASCADE;
     ALTER TABLE silas_stories.ChangeEmailCode ADD CONSTRAINT FK_6E8F5FCBF396750 FOREIGN KEY (id) REFERENCES silas_stories.Code (id) ON DELETE CASCADE;
     ALTER TABLE UserAccess ADD CONSTRAINT FK_26623A76631A48FA FOREIGN KEY (UserId) REFERENCES silas_stories.User (id);
     ALTER TABLE UserAccess ADD CONSTRAINT FK_26623A76A1A046DD FOREIGN KEY (AccessId) REFERENCES silas_stories.Access (id);
     ALTER TABLE RoleUser ADD CONSTRAINT FK_2DDE86A9BF6EF8BE FOREIGN KEY (RoleId) REFERENCES silas_stories.Role (id);
     ALTER TABLE RoleUser ADD CONSTRAINT FK_2DDE86A9631A48FA FOREIGN KEY (UserId) REFERENCES silas_stories.User (id);
     ALTER TABLE RoleAccess ADD CONSTRAINT FK_337C2901BF6EF8BE FOREIGN KEY (RoleId) REFERENCES silas_stories.Role (id);
     ALTER TABLE RoleAccess ADD CONSTRAINT FK_337C2901A1A046DD FOREIGN KEY (AccessId) REFERENCES silas_stories.Access (id);
     ALTER TABLE RoleChildren ADD CONSTRAINT FK_88554C92E9982EB8 FOREIGN KEY (ParentId) REFERENCES silas_stories.Role (id);
     ALTER TABLE RoleChildren ADD CONSTRAINT FK_88554C92CD4052DB FOREIGN KEY (ChildId) REFERENCES silas_stories.Role (id);
     ALTER TABLE silas_stories.RegistrationCode ADD CONSTRAINT FK_126E73DABF396750 FOREIGN KEY (id) REFERENCES silas_stories.Code (id) ON DELETE CASCADE;
     ALTER TABLE silas_stories.RequestNewPasswordCode ADD CONSTRAINT FK_88D0AB92BF396750 FOREIGN KEY (id) REFERENCES silas_stories.Code (id) ON DELETE CASCADE;
     ALTER TABLE silas_stories.UserSetting ADD CONSTRAINT FK_B313C8B964B64DCC FOREIGN KEY (userId) REFERENCES silas_stories.User (id);
     ALTER TABLE silas_stories.Answer ADD CONSTRAINT FK_39CCE5928804049 FOREIGN KEY (preconditionId) REFERENCES silas_stories.Precondition (id);
     ALTER TABLE silas_stories.Answer ADD CONSTRAINT FK_39CCE59A4C3A0DA FOREIGN KEY (messageId) REFERENCES silas_stories.Message (id);
     ALTER TABLE silas_stories.Answer ADD CONSTRAINT FK_39CCE59447AAB6A FOREIGN KEY (sequenceId) REFERENCES silas_stories.Sequence (id);
     ALTER TABLE silas_stories.Answer ADD CONSTRAINT FK_39CCE59BF396750 FOREIGN KEY (id) REFERENCES silas_stories.ConditionObject (id) ON DELETE CASCADE;
     ALTER TABLE NextSequences ADD CONSTRAINT FK_90B57044AD318310 FOREIGN KEY (AnswerId) REFERENCES silas_stories.Answer (id);
     ALTER TABLE NextSequences ADD CONSTRAINT FK_90B57044B27A8BA FOREIGN KEY (SequenceId) REFERENCES silas_stories.Sequence (id);
     ALTER TABLE silas_stories.Chat ADD CONSTRAINT FK_69E493A13A4FD046 FOREIGN KEY (storyId) REFERENCES silas_stories.Story (id);
     ALTER TABLE ChatAuthors ADD CONSTRAINT FK_59C24CB82DE6E13C FOREIGN KEY (chatId) REFERENCES silas_stories.Chat (id);
     ALTER TABLE ChatAuthors ADD CONSTRAINT FK_59C24CB8A196F9FD FOREIGN KEY (authorId) REFERENCES silas_stories.Author (id);
     ALTER TABLE silas_stories.Precondition ADD CONSTRAINT FK_CB6157FDD1C549 FOREIGN KEY (conditionOneId) REFERENCES silas_stories.ConditionObject (id);
     ALTER TABLE silas_stories.Precondition ADD CONSTRAINT FK_CB6157F3A67FE19 FOREIGN KEY (conditionTwoId) REFERENCES silas_stories.ConditionObject (id);
     ALTER TABLE silas_stories.Precondition ADD CONSTRAINT FK_CB6157FBF396750 FOREIGN KEY (id) REFERENCES silas_stories.ConditionObject (id) ON DELETE CASCADE;
     ALTER TABLE silas_stories.Sequence ADD CONSTRAINT FK_3BD97FA93A4FD046 FOREIGN KEY (storyId) REFERENCES silas_stories.Story (id);
     ALTER TABLE silas_stories.Sequence ADD CONSTRAINT FK_3BD97FA928804049 FOREIGN KEY (preconditionId) REFERENCES silas_stories.Precondition (id);
     ALTER TABLE silas_stories.Sequence ADD CONSTRAINT FK_3BD97FA9BF396750 FOREIGN KEY (id) REFERENCES silas_stories.ConditionObject (id) ON DELETE CASCADE;
     ALTER TABLE silas_stories.SequencePlayed ADD CONSTRAINT FK_5D92015830FCA33B FOREIGN KEY (runId) REFERENCES silas_stories.Run (id);
     ALTER TABLE silas_stories.SequencePlayed ADD CONSTRAINT FK_5D920158447AAB6A FOREIGN KEY (sequenceId) REFERENCES silas_stories.Sequence (id);
     ALTER TABLE silas_stories.SequencePlayed ADD CONSTRAINT FK_5D9201585447E146 FOREIGN KEY (answerId) REFERENCES silas_stories.Answer (id);
     ALTER TABLE silas_stories.Message ADD CONSTRAINT FK_EFD74CEC447AAB6A FOREIGN KEY (sequenceId) REFERENCES silas_stories.Sequence (id);
     ALTER TABLE silas_stories.Message ADD CONSTRAINT FK_EFD74CEC2DE6E13C FOREIGN KEY (chatId) REFERENCES silas_stories.Chat (id);
     ALTER TABLE silas_stories.Message ADD CONSTRAINT FK_EFD74CECA196F9FD FOREIGN KEY (authorId) REFERENCES silas_stories.Author (id);
     ALTER TABLE silas_stories.Story ADD CONSTRAINT FK_7C88A4D18E737261 FOREIGN KEY (startSequenceId) REFERENCES silas_stories.Sequence (id);
     ALTER TABLE silas_stories.Run ADD CONSTRAINT FK_9F0C970B64B64DCC FOREIGN KEY (userId) REFERENCES silas_stories.User (id);
     ALTER TABLE silas_stories.Run ADD CONSTRAINT FK_9F0C970B3A4FD046 FOREIGN KEY (storyId) REFERENCES silas_stories.Story (id);



INSERT INTO Role (name, beschreibung) VALUES ('gast', 'Kein aktives oder eingeloggtes Mitglied');
INSERT INTO Role (name, beschreibung) VALUES ('user', 'Normales Mitglied');
INSERT INTO Role (name, beschreibung) VALUES ('admin', 'Admin, darf alles');

INSERT INTO RoleChildren (ParentId, ChildId) VALUES (2, 3);

INSERT INTO Access (name, beschreibung) VALUES ('offline', 'alles, was ein nicht eingeloggter User sehen darf');
INSERT INTO Access (name, beschreibung) VALUES ('online', 'alles, was ein eingeloggter User sehen darf');
INSERT INTO RoleAccess(RoleId, AccessId) VALUES (2,2);
INSERT INTO Access (name, beschreibung) VALUES ('default', 'darf jeder');
INSERT INTO RoleAccess(RoleId, AccessId) VALUES (1,3);
INSERT INTO RoleAccess(RoleId, AccessId) VALUES (2,3);
INSERT INTO RoleAccess (RoleId, AccessId) VALUES (1,1);
INSERT INTO `Access` (`name`, `beschreibung`) VALUES ('admin', 'darf nur ein Admin');
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (3, 4);

INSERT INTO Role (name, beschreibung) VALUES ('bookbinderAutor', 'Autor von Büchern in Bookbinder');
INSERT INTO `Access` (`id`, `name`, `beschreibung`) VALUES (NULL, 'bookbinderViewBooks', 'erlaubt das Ansehen der eigenen Bücher'), (NULL, 'bookbinderModifyBook', 'erlaubt das Erstellen und Verändern eigener Bücher'), (NULL, 'bookbinderDeleteBook', 'erlaubt das Löschen eigener Bücher'), (NULL, 'bookbinderBookoverwiev', 'erlaubt ein Buch anzusehen'), (NULL, 'bookbinderModifyChapter', 'erlaubt das Erstellen und Verändern eines Kapitels'), (NULL, 'bookbinderDeleteChapter', 'erlaubt das Löschen eines Kapitels'), (NULL, 'bookbinderChangeChapterPos', 'erlaubt das Verändern der Reihenfolge der Kapitel'), (NULL, 'bookbinderToPdf', 'erlaubt das Konvertieren zur PDF des Buches'), (NULL, 'bookbinderMakePublic', 'erlaubt das Veröffentlichen eines Buches');
INSERT INTO `RoleChildren` (`ParentId`, `ChildId`) VALUES ('4', '3');

INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 5);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 6);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 7);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 8);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 9);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 10);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 11);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 12);
INSERT INTO `RoleAccess` (`RoleId`, `AccessId`) VALUES (4, 13);


insert into `Access` set name='playStories', beschreibung='darf Stories spielen';
insert into `Role` set name='player', beschreibung='Story-player';
insert into `RoleAccess` set RoleId=5, AccessId=14;


-- ######################################################

insert into `Access` set name='editStory', beschreibung='darf stories bearbeiten';
insert into `Role` set name='storyAuthor', beschreibung='Story-Author';
insert into `RoleAccess` set RoleId=6, AccessId=15;


-- #######################Test-Data##################
insert into `Story` set name='firstStory', imgPath='img/test.png';
insert into `Chat` set storyId=1, imgPath='img/test.png', description='Familien-Chat', version=1, name='familie <3';
insert into `Author` set isUser=1, imgPath='img/test.png', description='It is a me, mario', name='Mario';
insert into `Author` set isUser=0, imgPath='img/test.png', description='Mein Bruder', name='Luigi';
insert into `Author` set isUser=0, imgPath='img/test.png', description='Meine Mutter', version=1, name='Mutter';
insert into `ChatAuthors` set authorId=1, chatId=1;
insert into `ChatAuthors` set authorId=2, chatId=1;
insert into `ChatAuthors` set authorId=3, chatId=1;
insert into `ConditionObject` set discriminator='sequence';
insert into `Sequence` set id=1, storyId=1;
update `Story` set `startSequenceId`='1' where `id`='1' limit 1;
insert into `Message` set sequenceId=1, atTime='-1', authorId=3, orderIndex=1, timeOffset=0, message='Kommt ihr zu ostern heim?', chatId=1;
insert into `Message` set sequenceId=1, atTime='-1', version=1, authorId=2, orderIndex=2, timeOffset=0, message='Nein', chatId=1;
insert into `Message` set sequenceId=1, atTime='-1', authorId=3, version=1, orderIndex=3, timeOffset=0, message='Schade, Anderer-Mario', id=3, chatId=1;
insert into `Message` set atTime='-1', authorId=1, version=1, orderIndex=4, timeOffset=0, message='Ja, Mama', chatId=1;
insert into `Message` set atTime='-1', authorId=1, version=1, orderIndex=4, timeOffset=0, message='Nein, ich kann nicht.', chatId=1;
insert into `ConditionObject` set discriminator='answer';
insert into `ConditionObject` set discriminator='answer';
insert into `Answer` set sequenceId=1, id=2, messageId=4;
insert into `Answer` set sequenceId=1, id=3, messageId=5;

insert into `ConditionObject` set discriminator='sequence';
insert into `ConditionObject` set discriminator='sequence';
insert into `Sequence` set id=4, storyId=1;
insert into `Sequence` set id=5, storyId=1;
insert into `Message` set sequenceId=4, atTime='-1', authorId=3, version=1, orderIndex=5, timeOffset=0, message='Ok...', chatId=1;
insert into `Message` set sequenceId=5, atTime='-1', authorId=3, version=1, orderIndex=5, timeOffset=0, message='Juhu!', id=8, chatId=1;
insert into `NextSequences` set SequenceId=5, AnswerId=2;
insert into `NextSequences` set SequenceId=4, AnswerId=3;
