Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1raIIU-0092tN-IV for pgsql-general@arkaria.postgresql.org; Wed, 14 Feb 2024 16:39:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1raIIS-007EdX-Vx for pgsql-general@arkaria.postgresql.org; Wed, 14 Feb 2024 16:39:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1raIIR-007EdF-8P for pgsql-general@lists.postgresql.org; Wed, 14 Feb 2024 16:39:44 +0000 Received: from fhigh6-smtp.messagingengine.com ([103.168.172.157]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1raIIO-006joM-1c for pgsql-general@lists.postgresql.org; Wed, 14 Feb 2024 16:39:42 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 5B4FC11400BE; Wed, 14 Feb 2024 11:39:38 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 14 Feb 2024 11:39:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1707928778; x=1708015178; bh=Bq4Nt0rrPXeHg2+0IenOqttgJHBwq1q2W/aF5Ufp0TU=; b= DtPMdRHaU/Y6SbkT71lyBdSWJRTtCDRy8FvhITBc8XeYbm34zn9m3tSUBQt77Fw9 95z9WhEYqruJAiGcd6nKo+sev89gUpCvFwwhH0syMY/lUiTMmJRQhyRvw4aXvhuo Z5qf7Z2ohptmJX7XCg7h1IjR7qekxEze0xVci8bpbOiJcIwFqa2ElSEFw64I0/0E S0Uu9ypbwa77XMbdf1GyIuHqERKyhNaA1mICXLi2sFD7l0dMHc0Qs9idG1Vb+zf1 HN4gzyrxxrkbkZ0zqKZEULLpbu5e0I6L+ipW0mz7ysoPY94PZy8DXPu92BYHAfq1 VnMovOVdZm/QEI8LkG/Iew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1707928778; x= 1708015178; bh=Bq4Nt0rrPXeHg2+0IenOqttgJHBwq1q2W/aF5Ufp0TU=; b=Z ZtldQUf+HAu2nL11iG8yFgxzFLKcE8YGmoQGxZsCBcm0pL+92FBzpTmgOI3CSUxV Awg5RBQz+LNNjMApYrbRX/5NzzXZUTCCazJ7jpmR2msw80Zufasj03KfjHHnzx78 /Sy5Ivq3K25oKlaok8yhP/T9zqw2gqhv5QL1EQLIXF4FDBGQLd3nCyRc100NRttM Q7O+Po9d0VrfiMNE6Y9hlhqvten7On3PcZ8AhzUMkYpHXC6VPq076+C59O4skz12 TbajxmqiJQhMpxk91vK9ynFIMhWiC3Vg++kwnR0rn566SAAhxe00gMAGXDYY6i9U ABw/l9maxyfW72x2C9yRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudejgdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpefhveeihfevlefffedthedukeevfefhfedtgeeifeev teffgfefhedtffetudettdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Feb 2024 11:39:37 -0500 (EST) Message-ID: <267180bd-cb81-4060-b945-47e455cbd978@aklaver.com> Date: Wed, 14 Feb 2024 08:39:36 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: PostgreSQL DB in prod, test, debug To: Erik Wienhold , Simon Connah Cc: "pgsql-general@lists.postgresql.org" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/14/24 02:38, Erik Wienhold wrote: > On 2024-02-14 10:59 +0100, Simon Connah wrote: > > The database schema should be defined by migration scripts that you also > check into version control with the rest of your application sources. > Some people also prefer a separate repository just for the database > schema, depending on how tightly coupled database and application are, > or if there are other applications relying on the database schema. > > I use Sqitch[1] which works well if you want to track an existing > database schema. Alembic is popular in Python but I don't know how it > works with an existing schema because Alembic migrations are usually not > written in plain SQL. Just to be clear you can start from scratch with Sqitch. The only thing that needs to be done outside of it is the original CREATE DATABASE statement. After that you can build the contents of the database from the beginning. At any point you can move forward(deploy) or backward(revert). For your use case the important feature is target, where each target is a different instance of the database. In your case prod, test and debug. This allow you to make changes in test/debug and when they are verified good deploy them to prod. -- Adrian Klaver adrian.klaver@aklaver.com