Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan-Hendrik Willms
Stud.IP
Commits
11b3170a
Commit
11b3170a
authored
2 years ago
by
Elmar Ludwig
Browse files
Options
Downloads
Patches
Plain Diff
add index for booking_id to resource_booking_intervals, fixes #198
Closes #198
parent
37b00233
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db/migrations/5.1.29_add_index_resource_booking_intervals.php
+42
-0
42 additions, 0 deletions
...igrations/5.1.29_add_index_resource_booking_intervals.php
with
42 additions
and
0 deletions
db/migrations/5.1.29_add_index_resource_booking_intervals.php
0 → 100644
+
42
−
0
View file @
11b3170a
<?php
class
AddIndexResourceBookingIntervals
extends
Migration
{
public
function
description
()
{
return
'add index for booking_id to resource_booking_intervals'
;
}
public
function
up
()
{
$db
=
DBManager
::
get
();
// avoid running this migration twice
$sql
=
"SHOW INDEX FROM resource_booking_intervals WHERE Key_name = 'booking_id'"
;
$result
=
$db
->
query
(
$sql
);
if
(
$result
&&
$result
->
rowCount
()
>
0
)
{
return
;
}
// index "assign_object_id" may not exist (depending on upgrade path)
$sql
=
"SHOW INDEX FROM resource_booking_intervals WHERE Key_name = 'assign_object_id'"
;
$result
=
$db
->
query
(
$sql
);
if
(
$result
&&
$result
->
rowCount
()
>
0
)
{
$sql
=
'ALTER TABLE resource_booking_intervals DROP INDEX assign_object_id'
;
$db
->
exec
(
$sql
);
}
$sql
=
'ALTER TABLE resource_booking_intervals ADD INDEX booking_id (booking_id)'
;
$db
->
exec
(
$sql
);
}
public
function
down
()
{
$db
=
DBManager
::
get
();
$query
=
'ALTER TABLE resource_booking_intervals DROP INDEX booking_id'
;
$db
->
exec
(
$query
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment