INSERT INTO ConfigurationAdmin VALUES ('Link_EnhancedLinks', 'la_Text_Links', 'la_link_EnhancedLinks', 'checkbox', '', '', 9, 1);
INSERT INTO ConfigurationValues VALUES ('Link_EnhancedLinks', '0', 'In-Link', 'in-link:configuration_output');
ALTER TABLE ListingTypes ADD OnPurchaseAddToCatEnabled TINYINT DEFAULT '0' NOT NULL AFTER OnPurchasePriorityValue;
ALTER TABLE ListingTypes ADD OnExpireRemoveFromCatEnabled TINYINT DEFAULT '0' NOT NULL AFTER OnExpirePriorityValue;
ALTER TABLE ListingTypes ADD RenewalReminder INT NOT NULL, ADD EnableBuying TINYINT NOT NULL, ADD ShopCartName VARCHAR(255), ADD Price DOUBLE, ADD Recurring TINYINT NOT NULL;
ALTER TABLE ListingTypes ADD VirtualProductId INT DEFAULT '0' NOT NULL;
ALTER TABLE Listings ADD PendingRenewal TINYINT DEFAULT '0' NOT NULL;
ALTER TABLE Listings ADD RenewalReminderSent TINYINT DEFAULT '0' NOT NULL;

INSERT INTO Events VALUES ('', 'LINK.ENHANCE', '1', '0', 'In-Link', 'la_event_link.link.enhance', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE', '1', '0', 'In-Link', 'la_event_link.link.enhance', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.APPROVE', '0', '0', 'In-Link', 'la_event_link.link.enhance.approve', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.APPROVE', '1', '0', 'In-Link', 'la_event_link.link.enhance.approve', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.DENY', '0', '0', 'In-Link', 'la_event_link.link.enhance.deny', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.DENY', '1', '0', 'In-Link', 'la_event_link.link.enhance.deny', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.EXPIRE', '1', '0', 'In-Link', 'la_event_link.link.enhance.expire', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.EXPIRE', '1', '0', 'In-Link', 'la_event_link.link.enhance.expire', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.EXTEND', '1', '0', 'In-Link', 'la_event_link.link.enhance.extend', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.EXTEND', '1', '0', 'In-Link', 'la_event_link.link.enhance.extend', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEW', '0', '0', 'In-Link', 'la_event_link.link.enhance.renew', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEW', '1', '0', 'In-Link', 'la_event_link.link.enhance.renew', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEW.FAILED', '1', '0', 'In-Link', 'la_event_link.link.enhance.renew_failed', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEW.FAILED', '1', '0', 'In-Link', 'la_event_link.link.enhance.renew_failed', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.CANCEL', '1', '0', 'In-Link', 'la_event_link.link.enhance.renew_cancel', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.CANCEL', '1', '0', 'In-Link', 'la_event_link.link.enhance.renew_cancel', '0');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEWAL.NOTICE', '1', '0', 'In-Link', 'la_event_link.link.enhance.renewal_notice', '1');
INSERT INTO Events VALUES ('', 'LINK.ENHANCE.RENEWAL.NOTICE', '1', '0', 'In-Link', 'la_event_link.link.enhance.renewal_notice', '0');

INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.ADD', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.VIEW', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.ADD.PENDING', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.MODIFY', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.DELETE', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.RATE', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.REVIEW', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.REVIEW.PENDING', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.MODIFY.PENDING', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.OWNER.MODIFY', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.OWNER.MODIFY.PENDING', -1, 0, 0, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('LINK.OWNER.DELETE', -1, 0, 0, 0);

UPDATE Modules SET Version = '3.1.1' WHERE Name = 'In-Link';