hackatime/db/migrate/20260219153152_create_goals.rb
Mahad Kalam e3456be187
goaaaal! (#985)
* Add goals

* Fix up some migrations

* Formatting

* Simplify migration

* Update test/controllers/settings_goals_controller_test.rb

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Update test/controllers/settings_goals_controller_test.rb

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* Fix svelte-check issues, make CI less janky on dev

* svelte-check/fix tests

* Fix N+1s

* Formatting!

* More tests, fix anonymization and N+1

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-19 18:47:01 +00:00

16 lines
533 B
Ruby

class CreateGoals < ActiveRecord::Migration[8.1]
def change
create_table :goals do |t|
t.references :user, null: false, foreign_key: true
t.string :period, null: false
t.integer :target_seconds, null: false
t.string :languages, array: true, default: [], null: false
t.string :projects, array: true, default: [], null: false
t.timestamps
end
add_index :goals,
[ :user_id, :period, :target_seconds, :languages, :projects ],
name: "index_goals_on_user_and_scope"
end
end