From 558100c35e552983d67146a7fcda4f01ffa30784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 3 Sep 2023 15:28:32 +0200 Subject: [PATCH 1/2] Fix migration failing with PostgreSQL --- .../20230312212030_create_remote_storage_authorizations.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/migrate/20230312212030_create_remote_storage_authorizations.rb b/db/migrate/20230312212030_create_remote_storage_authorizations.rb index ebb8733..4c0330f 100644 --- a/db/migrate/20230312212030_create_remote_storage_authorizations.rb +++ b/db/migrate/20230312212030_create_remote_storage_authorizations.rb @@ -1,9 +1,12 @@ class CreateRemoteStorageAuthorizations < ActiveRecord::Migration[7.0] def change + db_type = ActiveRecord::Base.configurations.find_db_config(Rails.env).adapter + array_default = db_type == "postgresql" ? [] : [].to_yaml + create_table :remote_storage_authorizations do |t| t.references :user, null: false, foreign_key: true t.string :token - t.text :permissions, array: true, default: [].to_yaml + t.text :permissions, array: true, default: array_default t.string :client_id t.string :redirect_uri t.string :app_name From 96c669ab4e2816421bd18721510e9d7ca2d5a161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 3 Sep 2023 15:29:09 +0200 Subject: [PATCH 2/2] Update database schema, fix spec --- db/schema.rb | 3 +-- spec/jobs/create_lndhub_account_job_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 758a0d0..bdb7cd6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -84,13 +84,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_05_23_120753) do t.datetime "confirmed_at", precision: nil t.datetime "confirmation_sent_at", precision: nil t.string "unconfirmed_email" - t.text "ln_login_ciphertext" t.text "ln_password_ciphertext" t.string "ln_account" + t.string "nostr_pubkey" t.datetime "remember_created_at" t.string "remember_token" t.text "preferences" - t.string "nostr_pubkey" 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 diff --git a/spec/jobs/create_lndhub_account_job_spec.rb b/spec/jobs/create_lndhub_account_job_spec.rb index 51ffe2d..6a4d00a 100644 --- a/spec/jobs/create_lndhub_account_job_spec.rb +++ b/spec/jobs/create_lndhub_account_job_spec.rb @@ -25,7 +25,7 @@ RSpec.describe CreateLndhubAccountJob, type: :job do context "with existing credentials stored" do before do - user.ln_login = "foo" + user.ln_account = "foo" user.ln_password = "bar" user.save! end @@ -36,7 +36,7 @@ RSpec.describe CreateLndhubAccountJob, type: :job do expect(WebMock).to_not have_requested(:post, "http://localhost:3023/create") user.reload - expect(user.ln_login).to eq("foo") + expect(user.ln_account).to eq("foo") expect(user.ln_password).to eq("bar") end end