Skip to content

Commit

Permalink
Change user_id column non-nullable (mastodon#6435)
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikodaki authored and Gargron committed Feb 7, 2018
1 parent 95c8232 commit 67f7ffa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/invite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Table name: invites
#
# id :integer not null, primary key
# user_id :integer
# user_id :integer not null
# code :string default(""), not null
# expires_at :datetime
# max_uses :integer
Expand Down
2 changes: 1 addition & 1 deletion app/models/web/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# data :json
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# user_id :integer not null
#

class Web::Setting < ApplicationRecord
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20180206000000_change_user_id_nonnullable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class ChangeUserIdNonnullable < ActiveRecord::Migration[5.1]
def change
change_column_null :invites, :user_id, false
change_column_null :web_settings, :user_id, false
end
end
6 changes: 3 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180204034416) do
ActiveRecord::Schema.define(version: 20180206000000) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -195,7 +195,7 @@
end

create_table "invites", force: :cascade do |t|
t.bigint "user_id"
t.bigint "user_id", null: false
t.string "code", default: "", null: false
t.datetime "expires_at"
t.integer "max_uses"
Expand Down Expand Up @@ -516,7 +516,7 @@
t.json "data"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "user_id"
t.bigint "user_id", null: false
t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
end

Expand Down

0 comments on commit 67f7ffa

Please sign in to comment.