task/3382: Harmonisera tabellnamn #6
@ -1224,58 +1224,32 @@ alter table `user_profile_project_type`
|
||||
on delete cascade on update cascade;
|
||||
|
||||
|
||||
/* the mess with ProjectType
|
||||
/* Useful SQL
|
||||
|
||||
>>> SQL query for FK-to:
|
||||
|
||||
select table_name, column_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where table_schema = 'tozh4728' and
|
||||
referenced_table_name = 'ProjectType';
|
||||
select table_name, column_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where table_schema = 'tozh4728' and referenced_table_name = 'ProjectType';
|
||||
|
||||
>>> SQL query for FK-to count:
|
||||
|
||||
select referenced_table_name, count(*) as c
|
||||
from information_schema.key_column_usage
|
||||
where table_schema = 'tozh4728' and
|
||||
referenced_table_name is not null
|
||||
where table_schema = 'tozh4728' and referenced_table_name is not null
|
||||
group by referenced_table_name order by c desc;
|
||||
|
||||
>>> SQL Query for FK-from
|
||||
|
||||
select table_name, column_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where referenced_table_name is not null and table_name = 'user'
|
||||
order by table_name;
|
||||
select table_name, column_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where referenced_table_name is not null and table_name = 'user'
|
||||
order by table_name;
|
||||
|
||||
>>> Show foreign keys
|
||||
|
||||
select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where table_schema = 'tozh4728' and table_name = 'ActivityTemplate';
|
||||
select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name
|
||||
from information_schema.key_column_usage
|
||||
where table_schema = 'tozh4728' and table_name = 'ActivityTemplate' and constraint_name != 'PRIMARY';
|
||||
|
||||
A. Drop FK from following tables
|
||||
|
||||
1. ExternalResource
|
||||
2. project_type_settings
|
||||
3. project_type_project_modules
|
||||
4. projectPartner
|
||||
5. target
|
||||
6. checklist_template_ProjectType
|
||||
|
||||
7. grading_report_template
|
||||
8. milestone_activity_template_ProjectType
|
||||
9. ApplicationPeriodProjectType
|
||||
|
||||
10. user_profile_ProjectType
|
||||
|
||||
11. idea
|
||||
12. project
|
||||
|
||||
B. Fix table ProjectType
|
||||
|
||||
C. Recreate FK for following tables without fixing the table.
|
||||
1. idea
|
||||
2. project
|
||||
|
||||
D. other tables can be fixed directly.
|
||||
*/
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user