
use score;
UPDATE  learning_objectives SET icon ='bookmark' where id > 0 ;
ALTER TABLE tasks
DROP COLUMN userId;
-- ADD the @ManyToOne(() => Users, (users) => users.tasks) relations  to "tasks"
ALTER TABLE tasks
ADD COLUMN  usersId INT,
ADD CONSTRAINT FK_38005df66f42efb4850385ec8fn
FOREIGN KEY (usersId)
REFERENCES users(id)
ON DELETE CASCADE ON UPDATE CASCADE;
-- Rename the "circularStrategiesId" COLUMN to "circularStrategiesGroup"
ALTER TABLE circular_strategies CHANGE circularStrategiesId circularStrategiesGroup varchar(255) NOT NULL;
-- Rename the "hashtags" TABLE to "keywords"
-- Rename the "hashtagsGroup" COLUMN to "keywordsGroup"
ALTER TABLE hashtags RENAME TO keywords;
ALTER TABLE keywords CHANGE hashtagsGroup keywordsGroup varchar(255) NOT NULL;
-- Rename the "learning_blocks_hashtags" TABLE to "learning_blocks_keywords"
-- Rename the "circular_challenges_hashtags" TABLE to "circular_challenges_keywords"
ALTER TABLE learning_blocks_hashtags RENAME TO learning_blocks_keywords;
ALTER TABLE circular_challenges_hashtags RENAME TO circular_challenges_keywords;
 
-- Rename columns "hashtags_id"  to "keywords_id" in circular_challenges and learning_blocks
 -- Drop the old FK references into learning_blocks_keywords for keywords_id 
ALTER TABLE learning_blocks_keywords
DROP FOREIGN KEY FK_cb7eef04feecc6751f63228565c;
ALTER TABLE circular_challenges_keywords CHANGE hashtags_id keywords_id int NOT NULL;
ALTER TABLE learning_blocks_keywords CHANGE hashtags_id keywords_id int NOT NULL;
ALTER TABLE learning_blocks_keywords ADD CONSTRAINT FK_42ef34ca3f01d27c01d1ac01f71 FOREIGN KEY (learningBlocks_id) REFERENCES learning_blocks(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE learning_blocks_keywords ADD CONSTRAINT FK_cb7eef04feecc6751f63228565n FOREIGN KEY (keywords_id) REFERENCES keywords(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE circular_challenges_keywords ADD CONSTRAINT FK_677e9454ed323db58d1d7841ce5 FOREIGN KEY (circular_challenges_id) REFERENCES circular_challenges(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE circular_challenges_keywords ADD CONSTRAINT FK_5a4a24e21e126bd35feb772319p FOREIGN KEY (keywords_id) REFERENCES keywords(id) ON DELETE CASCADE ON UPDATE CASCADE;
