INSERT INTO pat_revamp.mnt_brands (id,description,enabled,entity_id) 
SELECT id,description,enabled,entity_id
FROM pat.m_brands;

INSERT INTO pat_revamp.mnt_business_units (id,description,enabled,created_at,updated_at,manager_id) 
SELECT id,description,enabled,created_at,updated_at,manager_id 
FROM pat.m_business_units;

INSERT INTO pat_revamp.`mnt_entities` (id,description,enabled,billable) SELECT *  FROM pat.`m_entities`;

INSERT INTO pat_revamp.mnt_statuses (id,description,enabled) 
SELECT id,description,enabled 
FROM pat.m_statuses;

INSERT INTO pat_revamp.mnt_ticket_references (id,year,ticket_number,ticket_refcode,created_at) 
SELECT id,year,project_number,project_refcode,created_at
FROM pat.m_project_references;

INSERT INTO pat_revamp.mnt_ticket_types (id,name,enabled) 
SELECT id,name,enabled 
FROM pat.m_ticket_types;

INSERT INTO pat_revamp.txn_activities (id,ticket_id,date_log,type_id,activity,resource_id,hours,billable,brand_id,entity_id) 
SELECT id,project_id,date_log,type_id,activity,resource_id,hours,billable,brand_id,entity_id 
FROM pat.t_activities;

INSERT INTO pat_revamp.`txn_tickets` SELECT * FROM pat.`t_projects`;

INSERT INTO pat_revamp.`users` SELECT * FROM pat.`users`;

INSERT INTO pat_revamp.users (id,firstname, lastname, middlename, enabled, created_at, updated_at, start_date, end_date, email, is_internal, business_unit_id, manager_id) 
SELECT id,firstname, lastname, middlename, enabled, created_at, updated_at, start_date, end_date, email, is_internal, business_unit_id, manager_id
FROM pat.m_resources;

SET SQL_SAFE_UPDATES = 0;

UPDATE pat_revamp.users as tb1
INNER JOIN pat.users as tb2 ON tb1.id=tb2.resource_id
SET 
tb1.username=tb2.username,
tb1.password=tb2.password,
tb1.is_admin=tb2.is_admin,
tb1.added_by=tb2.added_by;

INSERT INTO pat_revamp.mnt_types (id,description,enabled) 
SELECT id,description,enabled 
FROM pat.m_types;

ALTER TABLE txn_tickets 
ADD ticket_description TEXT;

ALTER TABLE txn_tickets 
ADD ticket_member_ids TEXT;










  

