Skip to content

Commit f382dba

Browse files
committed
feat: make create project labels infallible
1 parent e967d8d commit f382dba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
class CreateProjectLabels < ActiveRecord::Migration[8.0]
22
# where was ts before?
3+
# precedent for future to make migration infallible
34
def change
4-
create_table :project_labels do |t|
5+
create_table :project_labels, if_not_exists: true do |t|
56
t.string :user_id, null: false
67
t.string :project_key, null: false
78
t.string :label, null: false
89
t.timestamps
910
end
1011

11-
add_index :project_labels, [ :user_id, :project_key ], unique: true
12-
add_index :project_labels, :user_id
12+
add_index :project_labels, [ :user_id, :project_key ], unique: true, if_not_exists: true
13+
add_index :project_labels, :user_id, if_not_exists: true
1314
end
1415
end

0 commit comments

Comments
 (0)