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 1mbm2j-0001vd-O2 for pgsql-novice@arkaria.postgresql.org; Sat, 16 Oct 2021 15:56:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbm2i-0006pI-B7 for pgsql-novice@arkaria.postgresql.org; Sat, 16 Oct 2021 15:56:16 +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 1mbm2h-0006p9-R3 for pgsql-novice@lists.postgresql.org; Sat, 16 Oct 2021 15:56:15 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mbm2f-0001TU-1l for pgsql-novice@lists.postgresql.org; Sat, 16 Oct 2021 15:56:14 +0000 Received: by mail-qt1-x82a.google.com with SMTP id z24so11549918qtv.9 for ; Sat, 16 Oct 2021 08:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jimkeener-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:subject:user-agent:in-reply-to:references:message-id :mime-version:content-transfer-encoding; bh=Vz9Amq0M+DVCcMEWBoh7tWf5d0/hxGLL/RvOumJYtek=; b=hhOr6NVDjGitWpHgwzibHpfCG8wcWlst8ekK5ofw8/q6AFc4uja+pAXk2cIPIgiVl5 rdVJKPAeovdiG1aC0i3MVu3+sf/H9oEYBV4i/SJzOr5olABEGIB4LoVp80wd/08ZFPR6 11scSxmbwlUk5lUH15UfhdwGA9axZvRcLZpVFgxt6einIQFwmwJFr+x4vbx4BxuGZIuG E26Krn01B180WEiSdlkLo3o+gsn1DhllIM6b2WFeBAFC6tt6sV8suNwnFzmu7ZNORxTw +JR41icVWZ9fEeZ7BrGjiUxYokPEe10ORVktDeC7KfAVRJivxedfm/S73dOb9y4mNXqJ twJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=Vz9Amq0M+DVCcMEWBoh7tWf5d0/hxGLL/RvOumJYtek=; b=kJqm3lQ1E6ykxDUAszy6sVmLFkREpr3f0tO2kuf1ABWWXVF+FT4uHKyNMC/MJgctuC FX4L/+N9OzY3GLh4RDtx+wtyV7W4YgT3HKmVuYTCmrcke28n41TF5GiMU3+IIkMhPbKv hC3bTKhVBWop5vMRsxmMayCmhTaKQm4/QhFWk8EHlcB4ln0Dkqv7fEnyK9JhIMHXEGy5 VvtkL09Spuvcz/+/ePkK5xb9sQx0/O1oGHyJq0BCQiMTGvRuCuIOF2jBq5oFrKdM0R5j q7gL/L0xl8zfBQ8MPotxiWkrjxioOO+ff/DZqDk6QqZFibVZlaHOCVmcfe6Y5QLF7Nob Zcdg== X-Gm-Message-State: AOAM531dC26/7Z7FeL8p598AVUf4rmFQ8tFakzX82hoVyz3Fg8XiSecq hkpOHFGrfHsXJt7MxvC88pzBK+lE3S0yyQ== X-Google-Smtp-Source: ABdhPJyHjwPjvbmoe1B6j7wZ3uySg1xbR6zR/Hh8t4rK7Tek2j/zD2RYyhv21PllakOrmuqs3QZGbQ== X-Received: by 2002:ac8:5a49:: with SMTP id o9mr20270519qta.416.1634399771842; Sat, 16 Oct 2021 08:56:11 -0700 (PDT) Received: from [127.0.0.1] (pool-72-77-44-213.pitbpa.fios.verizon.net. [72.77.44.213]) by smtp.gmail.com with ESMTPSA id s3sm3993639qkj.118.2021.10.16.08.56.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Oct 2021 08:56:11 -0700 (PDT) Date: Sat, 16 Oct 2021 11:56:07 -0400 From: James Keener To: pgsql-novice@lists.postgresql.org, Norton Glitz Subject: Re: Modeling database User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <71D13FFB-64FF-4412-8AB0-D03B56CA4644@jimkeener.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----FTNH2IICTP8AMOM8942JVKV99SWTV3 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------FTNH2IICTP8AMOM8942JVKV99SWTV3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I wouldn't automatically remove/disabled anything without the user choosing= =2E You could have a before trigger that will fail if the new plan has fewer a= ds than they currently have active=2E You can return an error message when = you `raise` the error that the application can use to notify the user that = they need to choose which ads to disable before downgrading their account= =2E=20 Jim On October 15, 2021 9:51:21 PM EDT, Norton Glitz wrote: >Hello, > >In my site users will choose one subscription to have a certain amount of >properties to advertise=2E > >For example, if he bought a subscription with 5 ads, he can advertise 3 >houses and 2 apartments=2E > >The user can also modify the subscription, for like 10 ads=2E Now the sam= e >user can advertise 5 more properties=2E But he can also decrease the amou= nt >of ads, for example 2=2E But in this case he will have already more than = 2 >ads running=2E > >Is there a way for everytime the subscription changes, if he has more ads >than the subscription allows it just turn off the amount that is more tha= n >hired? > >I'm not sure how to model this problem yet=2E Any answer would be awesome= =2E > >Thank you --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E ------FTNH2IICTP8AMOM8942JVKV99SWTV3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable I wouldn't automatically remove/disabled anything = without the user choosing=2E

You could have a before trigger that wi= ll fail if the new plan has fewer ads than they currently have active=2E Yo= u can return an error message when you `raise` the error that the applicati= on can use to notify the user that they need to choose which ads to disable= before downgrading their account=2E

Jim

On October 15, 2021 9:51:21 PM EDT, Norton Glitz <norton=2Eglitz= @gmail=2Ecom> wrote:
Hello,

In m= y site users will choose one subscription to have a certain amount of prope= rties to advertise=2E

Fo= r example, if he bought a subscription with 5 ads, he can advertise 3 house= s and 2 apartments=2E

Th= e user can also modify the subscription, for like 10 ads=2E Now the same us= er can advertise 5 more properties=2E But he can also decrease the amount o= f ads, for example 2=2E But in this case he will have already more than 2 a= ds running=2E

Is there a= way for everytime the subscription changes, if he has more ads than the su= bscription allows it just turn off the amount that is more than hired?

I'm not sure how to model th= is problem yet=2E Any answer would be awesome=2E
Thank you
--
Sent from my Android device with K-9 Mail=2E Please ex= cuse my brevity=2E
------FTNH2IICTP8AMOM8942JVKV99SWTV3--