Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(migrations): add additional indexes to bookings table #240

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/migrations/0023_add_additional_indexes.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class AddAdditionalIndexes
include Clear::Migration

def change(dir)
dir.up do
execute("CREATE INDEX IF NOT EXISTS bookings_booking_start_end_idx ON bookings (booking_start, booking_end)")
execute("CREATE INDEX IF NOT EXISTS bookings_booking_user_id_idx ON bookings (user_id)")
execute("CREATE INDEX IF NOT EXISTS bookings_booking_email_digest_idx ON bookings (email_digest)")
end

dir.down do
execute("DROP INDEX IF EXISTS bookings_booking_start_end_idx")
execute("DROP INDEX IF EXISTS bookings_booking_user_id_idx")
execute("DROP INDEX IF EXISTS bookings_booking_email_digest_idx")
end
end
end