Add migration for unencrypted ln login field
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Râu Cao 2023-01-11 19:50:01 +08:00
parent 68e0d00f6e
commit 51952ecdc2
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
4 changed files with 32 additions and 2 deletions

View File

@ -7,7 +7,8 @@ class CreateLndhubAccountJob < ApplicationJob
lndhub = LndhubV2.new
credentials = lndhub.create_account
user.update! ln_login: credentials["login"],
user.update! ln_account: credentials["login"],
ln_login: credentials["login"], # TODO remove when production is migrated
ln_password: credentials["password"]
end
end

View File

@ -0,0 +1,9 @@
class AddLnAccountToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :ln_account, :string
User.all.each do |user|
user.update! ln_account: user.ln_login
end
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2021_11_20_010540) do
ActiveRecord::Schema[7.0].define(version: 2023_01_11_113139) do
create_table "donations", force: :cascade do |t|
t.integer "user_id"
t.integer "amount_sats"
@ -48,6 +48,7 @@ ActiveRecord::Schema[7.0].define(version: 2021_11_20_010540) do
t.string "unconfirmed_email"
t.text "ln_login_ciphertext"
t.text "ln_password_ciphertext"
t.string "ln_account"
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end

19
spec/fixtures/lndhub/incoming.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"id": 58,
"type": "incoming",
"user_login": "689e27b237798b41d123",
"amount": 100,
"fee": 0,
"memo": "Sats for jimmy@kosmos.org: \"Buy you some beers\"",
"description_hash": "106af234beebd478206535486051b4f212bd31d2ed0f93e3efce7b5e7603d743",
"payment_request": "lnbc1u1p3mull3pp5qw4x46ew6kjknudypyjsg8maw935tr5kkuz7t6h7pugp3pt4msyqhp5zp40yd97a028sgr9x4yxq5d57gft6vwja58e8cl0eea4uasr6apscqzpgxqyz5vqsp53m2n8h6yeflgukv5fhwm802kur6un9w8nvycl7auk67w5g2u008q9qyyssqml8rfmxyvp32qd5939qx7uu0w6ppjuujlpwsrz28m9u0dzp799hz5j72w0xm8pg97hd4hdvwh9zxaw2hewnnmzewvc550f9y3qsfaegphmk0mu",
"destination_pubkey_hex": "024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946",
"r_hash": "03aa6aeb2ed5a569f1a40925041f7d7163458e96b705e5eafe0f10188575dc08",
"preimage": "3539663535656537343331663432653165396430623966633664656664646563",
"keysend": false,
"state": "settled",
"created_at": "2023-01-11T09:22:57.546364Z",
"expires_at": "2023-01-12T09:22:57.547209Z",
"updated_at": "2023-01-11T09:22:58.046236131Z",
"settled_at": "2023-01-11T09:22:58.046232174Z"
}