Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote
This commit is contained in:
commit
82b6413f61
12 changed files with 79 additions and 43 deletions
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToWebPushSubscriptionUser < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_check_constraint :web_push_subscriptions, 'user_id IS NOT NULL', name: 'web_push_subscriptions_user_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateAddNotNullToWebPushSubscriptionUser < ActiveRecord::Migration[8.0]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM web_push_subscriptions
|
||||
WHERE user_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :web_push_subscriptions, name: 'web_push_subscriptions_user_id_null'
|
||||
change_column_null :web_push_subscriptions, :user_id, false
|
||||
remove_check_constraint :web_push_subscriptions, name: 'web_push_subscriptions_user_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :web_push_subscriptions, 'user_id IS NOT NULL', name: 'web_push_subscriptions_user_id_null', validate: false
|
||||
change_column_null :web_push_subscriptions, :user_id, true
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddNotNullToWebPushSubscriptionAccessToken < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_check_constraint :web_push_subscriptions, 'access_token_id IS NOT NULL', name: 'web_push_subscriptions_access_token_id_null', validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ValidateAddNotNullToWebPushSubscriptionAccessToken < ActiveRecord::Migration[8.0]
|
||||
def up
|
||||
connection.execute(<<~SQL.squish)
|
||||
DELETE FROM web_push_subscriptions
|
||||
WHERE access_token_id IS NULL
|
||||
SQL
|
||||
|
||||
validate_check_constraint :web_push_subscriptions, name: 'web_push_subscriptions_access_token_id_null'
|
||||
change_column_null :web_push_subscriptions, :access_token_id, false
|
||||
remove_check_constraint :web_push_subscriptions, name: 'web_push_subscriptions_access_token_id_null'
|
||||
end
|
||||
|
||||
def down
|
||||
add_check_constraint :web_push_subscriptions, 'access_token_id IS NOT NULL', name: 'web_push_subscriptions_access_token_id_null', validate: false
|
||||
change_column_null :web_push_subscriptions, :access_token_id, true
|
||||
end
|
||||
end
|
|
@ -1606,8 +1606,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_04_23_224935) do
|
|||
t.json "data"
|
||||
t.datetime "created_at", precision: nil, null: false
|
||||
t.datetime "updated_at", precision: nil, null: false
|
||||
t.bigint "access_token_id"
|
||||
t.bigint "user_id"
|
||||
t.bigint "access_token_id", null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.boolean "standard", default: false, null: false
|
||||
t.index ["access_token_id"], name: "index_web_push_subscriptions_on_access_token_id", where: "(access_token_id IS NOT NULL)"
|
||||
t.index ["user_id"], name: "index_web_push_subscriptions_on_user_id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue