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 1mjsJs-000305-9C for pgsql-general@arkaria.postgresql.org; Mon, 08 Nov 2021 00:15:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mjsJL-0005QJ-1C for pgsql-general@arkaria.postgresql.org; Mon, 08 Nov 2021 00:14:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjsJK-0005QA-H7 for pgsql-general@lists.postgresql.org; Mon, 08 Nov 2021 00:14:54 +0000 Received: from mout-p-201.mailbox.org ([80.241.56.171]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mjsJC-0001KI-Qq for pgsql-general@lists.postgresql.org; Mon, 08 Nov 2021 00:14:52 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [80.241.60.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4HnWnt22BkzQjhc; Mon, 8 Nov 2021 01:14:42 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1636330477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fsTGfzLwwsBj3gZoD/y9CFGj8i7ntQNEImjpN9cmI2c=; b=OfMckVLpwEfROeiMOTMdRmlfvqGeGBTnt9e+PmPF17Z6eydmhesdCklRZHiEwnF8UXthrc IcWCkGt/yDwiOW/WxUQM7N4n4B1W62TbfisDpUr+16/sl27gAuDRzb/D7pqoCv/vrJdZFZ oMH9qBa4F3FyLpAITR2CXlPma4ACKBc976T3hEabMbMOV0E/i/mXWYDy4k76T3lgSEzjPt gl+DMVsQxizL6zVFE1XghFQ7zQkffXZmQGP47kWbFaComUuIkoVNu1VF052Exbw4uqEi6F baN6ikK67Apj10y2k99dSNhehtsdcDFisbpkWcOfnPrzBoFawKujjF5DkzjiRA== Date: Mon, 8 Nov 2021 01:14:34 +0100 (CET) From: Erik Wienhold To: Adrian Klaver , "pgsql-general@lists.postgresql.org" Message-ID: <1116172276.274316.1636330474638@office.mailbox.org> In-Reply-To: <8555f244-6bc0-51b0-9143-8caeaed150a7@aklaver.com> References: <766855348.80521.1636243329249@office.mailbox.org> <8555f244-6bc0-51b0-9143-8caeaed150a7@aklaver.com> Subject: Re: Design database schemas around a common subset of objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: A882A26B List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Adrian, > On 07/11/2021 18:38 Adrian Klaver wrote: > > My questions for this are: > > 1) How stable are the core objects? Hard to tell. A lot of changes were necessary for the prototype, as expected. It's considered stable by some team members, who unfortunately lack experience in database design and software development. My main fear, from experience, are breaking changes to unique keys, e.g. additional columns, that are likely to create issues in dependent views and queries. > 2) How divergent are the customer specific requirements? Different projects may use a different subset of objects. I don't mind having unused objects, e.g. empty tables, in the database schemas. I still have to find out what is expected to differ between projects. But it's impossible to anticipate every project and I bet there will be projects that won't fit our model and require breaking changes. One thing I already know that may differ is how modelled objects are named in the real world. We deal with plots of land, hence the geographic data. Depending on the region, these plots may use different naming schemes relevant to legal documents. The core objects would use a generated surrogate key but each project would have a dedicated relation that maps the real-world names of those plots to their surrogate keys. The real-world names can be normalized into multiple attributes instead of just storing names as text. This normalization may vary between projects, e.g. different number of attributes. > 3) Given 1) and 2) would it be possible to craft extensions that where > not customer specific? That's the goal. The core should not contain any project specifics. Doesn't need to be Postgres extensions because of the issue with pg_dump omitting the extension version which I described in my original post. I'm thinking about something like merges in Git. Database schemas for project-a and project-b are like separate repositories and changes in core are merged as necessary. This along with project-specific changes ("o" in the diagram below) should result in a sequence of migrations applied to the respective databases. project-a oo--o--ooo-o---o--oo----> ___/ _/ _________/ / / / core o--oo-o---o-o--o--> \ \__ \ \ \ \ project-b o--ooo--o-o-o--ooo-----> These merges (always from core to the projects) form a directed acyclic graph from which the migration sequence can be generated using a topological ordering. > 4) Are you using or have you looked at Sqitch(https://sqitch.org/)? Already looking into it after stumbling across it during research on the mailing lists ;) Erik