ALTER TABLE smd__category 
ADD createdAt timestamp DEFAULT current_timestamp,
ADD userID int(11) unsigned,
ADD organizationID int(11) unsigned,
ADD `global` tinyint(1) DEFAULT 0;

ALTER TABLE smd__category 
ADD CONSTRAINT FK_userID FOREIGN KEY (userID) REFERENCES cms__user(userID);

ALTER TABLE smd__category 
ADD CONSTRAINT FK_organization FOREIGN KEY (organizationID) REFERENCES smd__organization(organizationID);

CREATE TABLE smd__organization_has_category (
	organizationID int(11) unsigned NOT NULL,
	categoryID int(11) unsigned NOT NULL
);

ALTER TABLE smd__organization_has_category 
ADD CONSTRAINT FK_organization_ID FOREIGN KEY (organizationID) REFERENCES smd__organization(organizationID);

ALTER TABLE smd__organization_has_category 
ADD CONSTRAINT FK_category_ID FOREIGN KEY (categoryID) REFERENCES smd__category(categoryID);