Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
66146a6e
Commit
66146a6e
authored
Jun 29, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 429804: Add Foreign Keys to Multiselect fields
Patch By Alex Eiser <aeiser@arc.nasa.gov> r=mkanat, a=mkanat
parent
a6f41ad1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
DB.pm
Bugzilla/DB.pm
+10
-4
Schema.pm
Bugzilla/DB/Schema.pm
+1
-0
DB.pm
Bugzilla/Install/DB.pm
+22
-0
No files found.
Bugzilla/DB.pm
View file @
66146a6e
...
...
@@ -674,11 +674,17 @@ sub bz_add_field_tables {
$self
->
_bz_add_field_table
(
$field
->
name
,
$self
->
_bz_schema
->
FIELD_TABLE_SCHEMA
);
if
(
$field
->
type
==
FIELD_TYPE_MULTI_SELECT
)
{
$self
->
_bz_add_field_table
(
'bug_'
.
$field
->
name
,
$self
->
_bz_schema
->
MULTI_SELECT_VALUE_TABLE
);
if
(
$field
->
type
==
FIELD_TYPE_MULTI_SELECT
)
{
my
$ms_table
=
"bug_"
.
$field
->
name
;
$self
->
_bz_add_field_table
(
$ms_table
,
$self
->
_bz_schema
->
MULTI_SELECT_VALUE_TABLE
);
$self
->
bz_add_fk
(
$ms_table
,
'bug_id'
,
{
TABLE
=>
'bugs'
,
COLUMN
=>
'bug_id'
,
DELETE
=>
'CASCADE'
});
$self
->
bz_add_fk
(
$ms_table
,
'value'
,
{
TABLE
=>
$field
->
name
,
COLUMN
=>
'value'
});
}
}
sub
bz_drop_field_tables
{
...
...
Bugzilla/DB/Schema.pm
View file @
66146a6e
...
...
@@ -1401,6 +1401,7 @@ use constant FIELD_TABLE_SCHEMA => {
],
};
# Foreign Keys are added in Bugzilla::DB::bz_add_field_tables
use
constant
MULTI_SELECT_VALUE_TABLE
=>
{
FIELDS
=>
[
bug_id
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
},
...
...
Bugzilla/Install/DB.pm
View file @
66146a6e
...
...
@@ -526,6 +526,9 @@ sub update_table_definitions {
$dbh
->
bz_alter_column
(
'series'
,
'query'
,
{
TYPE
=>
'MEDIUMTEXT'
,
NOTNULL
=>
1
});
# Add FK to multi select field tables
_add_foreign_keys_to_multiselects
();
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
...
...
@@ -2993,6 +2996,25 @@ sub _check_content_length {
}
}
sub
_add_foreign_keys_to_multiselects
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$names
=
$dbh
->
selectcol_arrayref
(
'SELECT name
FROM fielddefs
WHERE type = '
.
FIELD_TYPE_MULTI_SELECT
);
foreach
my
$name
(
@$names
)
{
$dbh
->
bz_add_fk
(
"bug_$name"
,
"bug_id"
,
{
TABLE
=>
'bugs'
,
COLUMN
=>
'bug_id'
,
DELETE
=>
'CASCADE'
,});
$dbh
->
bz_add_fk
(
"bug_$name"
,
"value"
,
{
TABLE
=>
$name
,
COLUMN
=>
'value'
,
DELETE
=>
'RESTRICT'
,});
}
}
sub
_populate_bugs_fulltext
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$fulltext
=
$dbh
->
selectrow_array
(
'SELECT 1 FROM bugs_fulltext '
...
...
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