mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Add index only if it doesn't exist.
This commit is contained in:
parent
4c6baad5d4
commit
52335d6a64
3 changed files with 19 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
0.23.1
|
||||
0.23.2
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# 0.23.2 - 2025-01-21
|
||||
|
||||
### Fixed
|
||||
|
||||
- Add index only if it doesn't exist.
|
||||
|
||||
# 0.23.1 - 2025-01-21
|
||||
|
||||
### Fixed
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ class AddUniqueIndexToPoints < ActiveRecord::Migration[8.0]
|
|||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
return if index_exists?(
|
||||
:points, %i[latitude longitude timestamp user_id],
|
||||
name: 'unique_points_lat_long_timestamp_user_id_index'
|
||||
)
|
||||
|
||||
add_index :points, %i[latitude longitude timestamp user_id],
|
||||
unique: true,
|
||||
name: 'unique_points_lat_long_timestamp_user_id_index',
|
||||
|
|
@ -11,6 +16,12 @@ class AddUniqueIndexToPoints < ActiveRecord::Migration[8.0]
|
|||
end
|
||||
|
||||
def down
|
||||
remove_index :points, name: 'unique_points_lat_long_timestamp_user_id_index'
|
||||
return unless index_exists?(
|
||||
:points, %i[latitude longitude timestamp user_id],
|
||||
name: 'unique_points_lat_long_timestamp_user_id_index'
|
||||
)
|
||||
|
||||
remove_index :points, %i[latitude longitude timestamp user_id],
|
||||
name: 'unique_points_lat_long_timestamp_user_id_index'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue