
START TRANSACTION;

INSERT INTO `user` VALUES (2, 'user_test', 'password', 'user_test@origo.inf.ethz.ch', '', 'false');
INSERT INTO `user` VALUES (3, 'user_disabled', 'password', 'user_disabled@origo.inf.ethz.ch', '', 'true');
INSERT INTO `user` VALUES (4, 'user_owner', 'password', 'user_owner@origo.inf.ethz.ch', '', 'false');
INSERT INTO `user` VALUES (5, 'user_admin', 'password', 'user_admin@origo.inf.ethz.ch', '', 'false');
INSERT INTO `user` VALUES (6, 'user_community_admin', 'password', 'user_community_admin@origo.inf.ethz.ch', '', 'false');

INSERT INTO `user_association` VALUES (2, 2);
INSERT INTO `user_association` VALUES (3, 2);
INSERT INTO `user_association` VALUES (4, 2);
INSERT INTO `user_association` VALUES (5, 1);
INSERT INTO `user_association` VALUES (5, 2);
INSERT INTO `user_association` VALUES (6, 2);

INSERT INTO `user_information` (`user_id`, `first_name`, `last_name`) VALUES ('2' , 'first_name', 'last_name');
INSERT INTO `user_information` (`user_id`, `first_name`, `last_name`) VALUES ('3' , 'first_name', 'last_name');
INSERT INTO `user_information` (`user_id`, `first_name`, `last_name`) VALUES ('4' , 'first_name', 'last_name');
INSERT INTO `user_information` (`user_id`, `first_name`, `last_name`) VALUES ('5' , 'first_name', 'last_name');
INSERT INTO `user_information` (`user_id`, `first_name`, `last_name`) VALUES ('6' , 'first_name', 'last_name');

INSERT INTO `project` VALUES (1, 'project-test', 'logourl', 2, 2, '', '', '0', '0');
INSERT INTO `project` VALUES (2, 'project-other', 'logourl', 2, 2, '', '', '0', '0');

INSERT INTO `project_information` VALUES (1, 'short_desc1', 'desc1',  'prog1',  'os1',  'license1', 'category1');
INSERT INTO `project_information` VALUES (2, 'short_desc2', 'desc2',  'prog2',  'os2',  'license2', 'category2');

INSERT INTO `user_project_association` VALUES (1, 4, 2);	# user_test is only a project member of project_test
INSERT INTO `user_project_association` VALUES (1, 3, 4);	# user_owner is the owner of project_test

INSERT INTO `community` (`community_id`, `name`, `description`, `logo`) VALUES (1, 'community-test', 'This is a description for the test community.', 'no');

INSERT INTO `community_wiki` (`wiki_id`, `community_id`, `title`, `private`) VALUES (1, 1, 'Public', 'false');
INSERT INTO `community_wiki` (`wiki_id`, `community_id`, `title`, `private`) VALUES (2, 1, 'Private', 'true');
INSERT INTO `community_wiki_revision` (`wiki_revision_id`, `wiki_id`, `community_wiki_revision`, `creation_time`, `user_id`, `title`, `text`) VALUES
(1, 1, 1, UNIX_TIMESTAMP(), 1, 'Title One', 'Text for wiki page one.'),
(2, 1, 2, UNIX_TIMESTAMP(), 6, 'Title One', 'Text for wiki page one. Revised.'),
(3, 2, 1, UNIX_TIMESTAMP(), 6, 'Title Two', 'Text for wiki page two.');

INSERT INTO `user_community_association` (`community_id`, `group_id`, `user_id`) VALUES (1, 7, 2);# user_test is just a member
INSERT INTO `user_community_association` (`community_id`, `group_id`, `user_id`) VALUES (1, 6, 6);# user_admin is an admin

INSERT INTO `project_community_association` (`community_id`, `project_id`) VALUES (1, 1);# project_test <=> community_test

# Add a test release to project_other
INSERT INTO `release` VALUES (1, 2, 12345, 'some release', 'test release', '32');
INSERT INTO `release_file` VALUES (1, 1, 'test.exe', 'win32');

# Some issues

INSERT INTO `issue` VALUES (1, 1, 1, "issue_project_test", 0, 0, 1234, 10);
INSERT INTO `issue` VALUES (2, 1, 2, "issue_project_other", 0, 0, 0, 0);
INSERT INTO `issue` VALUES (3, 2, 1, "issue_project_test_2", 0, 0, 0, 0);
INSERT INTO `issue` VALUES (4, 1, 3, "Title Issue Three for Project 1", 0, 0, 0, 0);

INSERT INTO `issue_revision` VALUES (1, 1, UNIX_TIMESTAMP(), 4, "issue 1");
INSERT INTO `issue_revision` VALUES (2, 2, UNIX_TIMESTAMP(), 4, "issue 2");
INSERT INTO `issue_revision` VALUES (3, 2, UNIX_TIMESTAMP(), 2, "issue 2 reply");
INSERT INTO `issue_revision` VALUES (4, 4, UNIX_TIMESTAMP(), 4, "issue 3");
INSERT INTO `issue_revision` VALUES (5, 3, UNIX_TIMESTAMP(), 4, "issue 1 project 2");

INSERT INTO `tag_text` VALUES (1, "status::open");
INSERT INTO `tag_text` VALUES (2, "subscribed::user_test");
INSERT INTO `tag_text` VALUES (3, "resolution::duplicate");

INSERT INTO `issue_tag_association` VALUES (1, 1);
INSERT INTO `issue_tag_association` VALUES (2, 1);
INSERT INTO `issue_tag_association` VALUES (3, 1);
INSERT INTO `issue_tag_association` VALUES (4, 1);
INSERT INTO `issue_tag_association` VALUES (5, 1);
INSERT INTO `issue_tag_association` VALUES (3, 2);
INSERT INTO `issue_tag_association` VALUES (4, 3);

INSERT INTO `issue_attachment` VALUES (1, 1, 'attached_file.zip', 'My first attachment');


# Workitems relating to the data above (release & issues)

INSERT INTO `wi` (`id`, `type_id`, `timestamp`, `project_id`, `user_id`, `ref`, `title`, `revision`, `previous_revision`, `diff`, `comment_text`, `is_new`, `comment_type`, `log`, `issue_revision_id`, `release_id`, `is_private`)
VALUES
  -- a issue
  (1, 1, 1186255528, 1, 2, '', 'issue 1', NULL, NULL, NULL, NULL, 1, NULL, NULL, 1, NULL, NULL),
  -- A release
  (2, 2, 1186255528, 1, 2, '', 'some release', NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, 1, NULL),
  -- A commit
  (3, 3, 1186255560, 1, 2, '', 'Commit - Revision 33', 33, NULL, 'some diff', NULL, 1, NULL, 'some commit log', NULL, NULL, NULL),
  -- A wiki
  (4, 4, 1186255560, 1, 2, 'http://origo-local.ch/projects/project-test/wiki/some_wikiworkitem', 'Some wikiworkitem', 12, 11, 'some diff', NULL, 0, NULL, NULL, NULL, NULL, 0),
  -- A blog
  (5, 5, 1186255580, 1, 2, 'http://origo-local.ch/projects/project-test/blog/user_test/some_blog_title', 'some Blog title', 22, 21, 'blog diff', NULL, 0, NULL, NULL, NULL, NULL, NULL),
  -- A comment
  (6, 6, 1186255590, 1, 2, 'http://origo-local.ch/projects/project-test/node/13', 'some forum topic', NULL, NULL, NULL, 'some topic body', 1, 3, NULL, NULL, NULL, NULL),
  -- Another issue
  (NULL , '1', '1186255528', '1', '2', '', 'Title Issue Three for Project 1', NULL , NULL , NULL , NULL , 1, NULL , NULL , '4', NULL , NULL);

  -- This one is/was missing from the `workitem_wiki` table
  -- id / type / timestamp / proj.id / user id
--   INSERT INTO `workitem` VALUES (6, 4, 1186255525, 1, 5);


# Test application for key login test
INSERT INTO `application` VALUES (1, 'Test Application', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 0);



COMMIT;

