Skip to content

fix: project labels table not being created #465

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
14 changes: 14 additions & 0 deletions db/migrate/20250808184750_create_project_labels.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreateProjectLabels < ActiveRecord::Migration[8.0]
# where was ts before?
def change
create_table :project_labels do |t|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if our code is out of sync with production database, our code should support handling the unknown! Check out https://blog.saeloun.com/2020/02/10/rails-support-for-if-exists-if-not-exists-on-remove-column-add-column-in-migrations/

t.string :user_id, null: false
t.string :project_key, null: false
t.string :label, null: false
t.timestamps
end

add_index :project_labels, [ :user_id, :project_key ], unique: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check indentation- run the formatter!

add_index :project_labels, :user_id
end
end
14 changes: 13 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Creating test user
test_user = User.find_or_create_by(slack_uid: 'TEST123456') do |user|
user.username = 'testuser'
user.is_admin = true
user.admin_level = 2
# Ensure timezone is set to avoid nil timezone issues
user.timezone = 'America/New_York'
end
Expand Down