Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-bug-tracker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-bug-tracker
Commits
693dda9b
Commit
693dda9b
authored
Dec 29, 2015
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added v_count around alter table statements
parent
4afdfda9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
7 deletions
+55
-7
intranet-bug-tracker-drop.sql
sql/postgresql/intranet-bug-tracker-drop.sql
+55
-7
No files found.
sql/postgresql/intranet-bug-tracker-drop.sql
View file @
693dda9b
...
...
@@ -12,14 +12,29 @@ select im_menu__del_module('intranet-bug-tracker');
select
im_component_plugin__del_module
(
'intranet-bug-tracker'
);
create
or
replace
function
inline_0
()
returns
integer
as
$
body
$
DECLARE
v_count
integer
;
BEGIN
select
count
(
*
)
into
v_count
from
user_tab_columns
where
lower
(
table_name
)
=
'im_timesheet_tasks'
and
lower
(
column_name
)
=
'bt_bug_id'
;
IF
v_count
>
0
THEN
alter
table
im_timesheet_tasks
drop
column
bt_bug_id
;
END
IF
;
RETURN
0
;
END
;
$
body
$
language
'plpgsql'
;
SELECT
inline_0
();
DROP
FUNCTION
inline_0
();
-- Delete im_timesheet_tasks.bt_bug_id.
-- In order to delete the attribute, we need to
-- recreate dependent views:
--
drop
view
im_timesheet_tasks_view
;
alter
table
im_timesheet_tasks
drop
column
bt_bug_id
;
create
or
replace
view
im_timesheet_tasks_view
as
select
t
.
*
,
p
.
parent_id
as
project_id
,
...
...
@@ -88,8 +103,41 @@ select im_dynfield_widget__delete (
);
alter
table
im_projects
drop
column
bt_project_id
;
alter
table
im_projects
drop
column
bt_component_id
;
alter
table
im_projects
drop
column
bt_found_in_version_id
;
alter
table
im_projects
drop
column
bt_fix_for_version_id
;
create
or
replace
function
inline_0
()
returns
integer
as
$
body
$
DECLARE
v_count
integer
;
BEGIN
select
count
(
*
)
into
v_count
from
user_tab_columns
where
lower
(
table_name
)
=
'im_projects'
and
lower
(
column_name
)
=
'bt_project_id'
;
IF
v_count
>
0
THEN
alter
table
im_timesheet_tasks
drop
column
bt_project_id
;
END
IF
;
select
count
(
*
)
into
v_count
from
user_tab_columns
where
lower
(
table_name
)
=
'im_projects'
and
lower
(
column_name
)
=
'bt_component_id'
;
IF
v_count
>
0
THEN
alter
table
im_timesheet_tasks
drop
column
bt_component_id
;
END
IF
;
select
count
(
*
)
into
v_count
from
user_tab_columns
where
lower
(
table_name
)
=
'im_projects'
and
lower
(
column_name
)
=
'bt_found_in_version_id'
;
IF
v_count
>
0
THEN
alter
table
im_timesheet_tasks
drop
column
bt_found_in_version_id
;
END
IF
;
select
count
(
*
)
into
v_count
from
user_tab_columns
where
lower
(
table_name
)
=
'im_projects'
and
lower
(
column_name
)
=
'bt_fix_for_version_id'
;
IF
v_count
>
0
THEN
alter
table
im_timesheet_tasks
drop
column
bt_fix_for_version_id
;
END
IF
;
RETURN
0
;
END
;
$
body
$
language
'plpgsql'
;
SELECT
inline_0
();
DROP
FUNCTION
inline_0
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment