Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lojEe-0001hx-N7 for pgadmin-hackers@arkaria.postgresql.org; Thu, 03 Jun 2021 09:01:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lojEc-0004ht-VJ for pgadmin-hackers@arkaria.postgresql.org; Thu, 03 Jun 2021 09:01:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lojEc-0004hj-Pd for pgadmin-hackers@lists.postgresql.org; Thu, 03 Jun 2021 09:01:50 +0000 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lojEY-00023p-U7 for pgadmin-hackers@postgresql.org; Thu, 03 Jun 2021 09:01:50 +0000 Received: by mail-yb1-xb2c.google.com with SMTP id 207so7846186ybd.1 for ; Thu, 03 Jun 2021 02:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4MFTEPI7gX59Snq5S388zDAyTg+JtUkPIHcaSyOVTh4=; b=f+P2ys7Pub3Le7nCyZJnt82Q0YDilAUxGVfTYA0SgKZwNSU2cT6npiud7O7d7GxT3R 69sjdFZIqVeIefzgBh/DyZClZPNMZapGad1OZDd1FGeN2xBuqmCc9d/LPjLL40/b4m39 fQwIWE0jnsq5MjzhR4gz9IOICBYQRsTuin4BkgFtWZeBIs2TUAT0Hzyrz3jj+PrO6E4B is7lxmFVoM00M+vh4HR69r5lkXLVx4k7nYagG2y7O76Rn7HtEaXPYo/Yx4zoPFA0U6K6 lN8dvKHNqg4VpXQxzJv2ZMXdpxu7Vhg8wOAQT9pYb95wER9kcLdJFuYAx/G8FnvE1Yx2 vBZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4MFTEPI7gX59Snq5S388zDAyTg+JtUkPIHcaSyOVTh4=; b=o6eWVv4mS0ZvPZvwzSkiXRpbf6sXRiUKN10GNoScK4NmCX/Kk9fl59HIL6GHE61xjH CTc1IgdhcIlv4+jC/wLUTNQ4riRqzT0W6PgHkJzwuckReGXxnc/LikjEuYIpUgpR/3h8 SCnfSyhlv+Soqj5u0H1yyOaJFAK9wEcR4r+1HuCMpllqDBme7um44x2X9u/ISvr8GfEo PyPAGtai3gzcNvcZH2d07+U3XeYUIgg5A/BW04N79fWjQvG3/3WOTx9ZpbeK/p5QDlq+ BvAzE9I64WjWoEnrYCMh+D45uBeL/oIQD+qs5jV2qZC6sm3ADN75eWtOK3lGB2sA09jS JP8Q== X-Gm-Message-State: AOAM533zAddR3yANrtSmsHyLc/9I6siPczEExz2kgJh+EV+lLFtTKQoj CgDIUXN1lja1pYdrmPkl4B2RD5X99ttBbmj0NDtxtvjO95G4Gf+TRDjMqhdN+/d4qeSAt9t5gyx M5K8ixc4cHYop99l+6Bm1Tdv6dGGr+KfIQZmJ545SoXYkotsQqnXdBNc3pI5IxMymQJYbV95XPt arM5LfMS4pBHzLI6v9WIazeJsCF4tl4DcUbSRmUKUbvDJzpkG94ZPB0rLJOJCjZT0= X-Google-Smtp-Source: ABdhPJzZLaBjbSqlQIG43c6XSV6tvCaVErkFEIWNJ97o4o0Cb5AXwhif7dypglYL+Ar4NPIyPPevWJb5f/a4IoHHtYk= X-Received: by 2002:a25:b74d:: with SMTP id e13mr51729945ybm.372.1622710904032; Thu, 03 Jun 2021 02:01:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nikhil Mohite Date: Thu, 3 Jun 2021 14:31:32 +0530 Message-ID: Subject: Re: [pgAdmin][RM-6460]: Need a mechanism to detect a corrupt/broken config DB file. To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="00000000000002296405c3d8d30a" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000002296405c3d8d30a Content-Type: text/plain; charset="UTF-8" Hi Dave, On Thu, Jun 3, 2021 at 1:47 PM Dave Page wrote: > Hi > > On Thu, Jun 3, 2021 at 7:39 AM Nikhil Mohite < > nikhil.mohite@enterprisedb.com> wrote: > >> Hi Hackers, >> >> Please find the attached patch for RM-6460 >> : Need a mechanism to >> detect a corrupt/broken config DB file. >> >> 1. Added checks if all tables added in the model are present in SQLite DB >> or not. >> 2. If migrations fail it will backup older file and try migrations with >> the newly created file. >> (User will get notification on UI for the location of the backup file and >> newly created.) >> 3. If the user deleted any table from SQLite DB pgAdmin will not run on >> the next restart and it will add the missing table list in the logs. >> > > Surely if any tables have been deleted, it'll fail the check in point 1? > Yes, but if the user deletes any table while pgAdmin is running then it will fail when the user tries to run pgAdmin next time. (If we remove the table from the model it will not check particular table is present in DB or not. ) > > -- > Dave Page > Blog: https://pgsnake.blogspot.com > Twitter: @pgsnake > > EDB: https://www.enterprisedb.com > > Regards, Nikhil Mohite. --00000000000002296405c3d8d30a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Dave,

On Thu, Jun 3, 2021 at 1:47 PM Da= ve Page <dpage@pgadmin.org> = wrote:
Hi

On Thu, Jun 3, 2021 at 7:39 AM Nikhil Mohite = <nik= hil.mohite@enterprisedb.com> wrote:
Hi Hackers,

= Please find the attached patch for=C2=A0RM-6460:=C2=A0 Need a mechanism t= o detect a corrupt/broken config DB file.

1. Added= checks if all tables added in the model are present in SQLite DB or not.
2. If migrations fail it will backup older file and try migrations= with the newly created file.=C2=A0
(User will get notification o= n UI=C2=A0for the location=C2=A0of the backup file and newly created.)
3. If the user deleted any table from SQLite DB pgAdmin will not run = on the next restart and it will add the missing table list in the logs.

Surely if any tables have been del= eted, it'll fail the check in point 1?
Yes, but if the user deletes any table while pgAdmin is running then it = will fail when the user tries to run pgAdmin next time.
(If we re= move the table from the model it will not check particular table is present= in DB or not. )
=C2=A0
--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitte= r: @pgsnake

EDB: https://www.enterprisedb.com

Regards,
Nikhil Mohite.=C2=A0
--00000000000002296405c3d8d30a--