<commit_before>-- Add new repeating invoices functionality
ALTER TABLE invoice ADD invoiceRepeatID INTEGER DEFAULT NULL AFTER invoiceID;
ALTER TABLE invoice ADD invoiceRepeatDate DATE DEFAULT NULL AFTER invoiceRepeatID;
ALTER TABLE invoice ADD CONSTRAINT invoice_invoiceRepeatID FOREIGN KEY (invoiceRepeatID) REFERENCES invoiceRepeat (invoiceRepeatID);

DROP TABLE IF EXISTS invoiceRepeat;
CREATE TABLE invoiceRepeat (
  invoiceRepeatID integer NOT NULL auto_increment PRIMARY KEY,
  invoiceID integer NOT NULL,
  personID integer NOT NULL,
  message TEXT DEFAULT NULL,
  active BOOLEAN DEFAULT true
) ENGINE=InnoDB PACK_KEYS=0;

ALTER TABLE invoiceRepeat ADD CONSTRAINT invoiceRepeat_invoiceID FOREIGN KEY (invoiceID) REFERENCES invoice (invoiceID);
ALTER TABLE invoiceRepeat ADD CONSTRAINT invoiceRepeat_personID FOREIGN KEY (personID) REFERENCES person (personID);

INSERT INTO permission (tableName,entityID,roleName,actions,comment) VALUES ("invoiceRepeat",0,"admin",15,"Admin controls repeating invoices.");


DROP TABLE IF EXISTS invoiceRepeatDate;
CREATE TABLE invoiceRepeatDate (
  invoiceRepeatDateID integer NOT NULL auto_increment PRIMARY KEY,
  invoiceRepeatID integer NOT NULL,
  invoiceDate date NOT NULL
) ENGINE=InnoDB PACK_KEYS=0;


ALTER TABLE invoiceRepeatDate ADD CONSTRAINT invoiceRepeat_invoiceRepeatID FOREIGN KEY (invoiceRepeatID) REFERENCES invoiceRepeat (invoiceRepeatID);

INSERT INTO permission (tableName,entityID,roleName,actions,comment) VALUES ("invoiceRepeatDate",0,"admin",15,"Admin controls repeating invoices.");


ALTER TABLE invoice ADD invoiceCreatedTime datetime default NULL;
ALTER TABLE invoice ADD invoiceCreatedUser integer default NULL;
ALTER TABLE invoice ADD invoiceModifiedTime datetime default NULL;
ALTER TABLE invoice ADD invoiceModifiedUser integer default NULL;
<commit_msg>Bug in patchfile for repeating invoices.<commit_after>-- Add new repeating invoices functionality
ALTER TABLE invoice ADD invoiceRepeatID INTEGER DEFAULT NULL AFTER invoiceID;
ALTER TABLE invoice ADD invoiceRepeatDate DATE DEFAULT NULL AFTER invoiceRepeatID;

DROP TABLE IF EXISTS invoiceRepeat;
CREATE TABLE invoiceRepeat (
  invoiceRepeatID integer NOT NULL auto_increment PRIMARY KEY,
  invoiceID integer NOT NULL,
  personID integer NOT NULL,
  message TEXT DEFAULT NULL,
  active BOOLEAN DEFAULT true
) ENGINE=InnoDB PACK_KEYS=0;

ALTER TABLE invoice ADD CONSTRAINT invoice_invoiceRepeatID FOREIGN KEY (invoiceRepeatID) REFERENCES invoiceRepeat (invoiceRepeatID);
ALTER TABLE invoiceRepeat ADD CONSTRAINT invoiceRepeat_invoiceID FOREIGN KEY (invoiceID) REFERENCES invoice (invoiceID);
ALTER TABLE invoiceRepeat ADD CONSTRAINT invoiceRepeat_personID FOREIGN KEY (personID) REFERENCES person (personID);

INSERT INTO permission (tableName,entityID,roleName,actions,comment) VALUES ("invoiceRepeat",0,"admin",15,"Admin controls repeating invoices.");


DROP TABLE IF EXISTS invoiceRepeatDate;
CREATE TABLE invoiceRepeatDate (
  invoiceRepeatDateID integer NOT NULL auto_increment PRIMARY KEY,
  invoiceRepeatID integer NOT NULL,
  invoiceDate date NOT NULL
) ENGINE=InnoDB PACK_KEYS=0;


ALTER TABLE invoiceRepeatDate ADD CONSTRAINT invoiceRepeat_invoiceRepeatID FOREIGN KEY (invoiceRepeatID) REFERENCES invoiceRepeat (invoiceRepeatID);

INSERT INTO permission (tableName,entityID,roleName,actions,comment) VALUES ("invoiceRepeatDate",0,"admin",15,"Admin controls repeating invoices.");


ALTER TABLE invoice ADD invoiceCreatedTime datetime default NULL;
ALTER TABLE invoice ADD invoiceCreatedUser integer default NULL;
ALTER TABLE invoice ADD invoiceModifiedTime datetime default NULL;
ALTER TABLE invoice ADD invoiceModifiedUser integer default NULL;

{'fraction_non_alphanumeric': 0.04860168341026337, 'fraction_numerical': 0.004344284550638067, 'mean_word_length': 7.3917995444191344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6585343', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1013, 'n_words': 369}