Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31429 from code-dot-org/lets-make-this-table
Create UserLevelInfo Table
- Loading branch information
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# == Schema Information | ||
# | ||
# Table name: user_level_infos | ||
# | ||
# id :integer not null, primary key | ||
# time_spent :integer default(0) | ||
# user_level_id :integer unsigned | ||
# | ||
|
||
class UserLevelInfo < ApplicationRecord | ||
end |
8 changes: 8 additions & 0 deletions
8
dashboard/db/migrate/20191023192120_create_user_level_infos.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class CreateUserLevelInfos < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :user_level_infos do |t| | ||
t.integer :time_spent, default: 0 | ||
t.bigint :user_level_id, unsigned: true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'test_helper' | ||
|
||
class UserLevelInfoTest < ActiveSupport::TestCase | ||
test "can create user_level_info" do | ||
user_level_info = create :user_level_info | ||
assert_equal user_level_info.user_level_id, 1 | ||
assert_equal user_level_info.time_spent, 10 | ||
end | ||
end |