-- Commands to cleanup tables and columns which are not used anymore
-- (Kantree migrations do not delete them automatically)

DROP TABLE IF EXISTS board_template_lists;
DROP TABLE IF EXISTS board_templates;
DROP TABLE IF EXISTS card_lists;
DROP TABLE IF EXISTS milestones;
DROP TABLE IF EXISTS card_lists;

ALTER TABLE attributes DROP COLUMN IF EXISTS card_model_id;
ALTER TABLE attributes DROP COLUMN IF EXISTS show_on_tile;

ALTER TABLE cards DROP COLUMN IF EXISTS board_bgcolor;

ALTER TABLE card_change_history DROP COLUMN IF EXISTS list_id;
ALTER TABLE card_change_history DROP COLUMN IF EXISTS list_title;

ALTER TABLE card_models DROP COLUMN IF EXISTS builtin;
ALTER TABLE card_models DROP COLUMN IF EXISTS auto_enabled_on_new_projects;
ALTER TABLE card_models DROP COLUMN IF EXISTS board_template_id;
ALTER TABLE card_models DROP COLUMN IF EXISTS mongo_id;
ALTER TABLE card_models DROP COLUMN IF EXISTS card_template_id;
ALTER TABLE card_models DROP COLUMN IF EXISTS dynamic_extends;
ALTER TABLE card_models DROP COLUMN IF EXISTS is_base;

ALTER TABLE card_group_types DROP COLUMN IF EXISTS auto_enabled_on_new_projects;
ALTER TABLE card_group_types DROP COLUMN IF EXISTS display_on_card;

ALTER TABLE card_groups DROP COLUMN IF EXISTS auto_assign_user;
ALTER TABLE card_groups DROP COLUMN IF EXISTS milestone_id;

ALTER TABLE organizations DROP COLUMN IF EXISTS can_invite_guest_collabs;
ALTER TABLE organizations DROP COLUMN IF EXISTS can_create_private_boards;
ALTER TABLE organizations DROP COLUMN IF EXISTS mongo_id;
ALTER TABLE organizations DROP COLUMN IF EXISTS default_card_group_type_id;

ALTER TABLE projects DROP COLUMN IF EXISTS public_permission;
ALTER TABLE projects DROP COLUMN IF EXISTS default_org_member_permission;
ALTER TABLE projects DROP COLUMN IF EXISTS icon;
ALTER TABLE projects DROP COLUMN IF EXISTS oneliner;

ALTER TABLE project_members DROP COLUMN IF EXISTS permission;

ALTER TABLE users DROP COLUMN IF EXISTS enable_email_notifications;
ALTER TABLE users DROP COLUMN IF EXISTS enable_emails;
ALTER TABLE users DROP COLUMN IF EXISTS mongo_id;
ALTER TABLE users DROP COLUMN IF EXISTS username_lcase;
ALTER TABLE users DROP COLUMN IF EXISTS trello_user_id;
ALTER TABLE users DROP COLUMN IF EXISTS trello_username;
ALTER TABLE users DROP COLUMN IF EXISTS trello_oauth_token;
ALTER TABLE users DROP COLUMN IF EXISTS trello_oauth_token_secret;
ALTER TABLE users DROP COLUMN IF EXISTS github_access_token;
ALTER TABLE users DROP COLUMN IF EXISTS github_username;
ALTER TABLE users DROP COLUMN IF EXISTS github_id;
ALTER TABLE users DROP COLUMN IF EXISTS github_email;
ALTER TABLE users DROP COLUMN IF EXISTS github_scope;
ALTER TABLE users DROP COLUMN IF EXISTS asana_token;
ALTER TABLE users DROP COLUMN IF EXISTS asana_name;
ALTER TABLE users DROP COLUMN IF EXISTS asana_id;
ALTER TABLE users DROP COLUMN IF EXISTS asana_email;
ALTER TABLE users DROP COLUMN IF EXISTS google_token;
ALTER TABLE users DROP COLUMN IF EXISTS google_refresh_token;
ALTER TABLE users DROP COLUMN IF EXISTS google_id;
ALTER TABLE users DROP COLUMN IF EXISTS google_name;
ALTER TABLE users DROP COLUMN IF EXISTS google_email;
ALTER TABLE users DROP COLUMN IF EXISTS google_token_expiry;
