See below

On Thu, Jan 3, 2013 at 9:10 AM, Arnon Marcus <a.m.mar...@gmail.com> wrote:

> An example of something you NEED phpPGadmin/PgAdminIII is
> "multi-field uniqueness":
>
> Lets say you have a table, with 3 fields - first-name, a last-name and
> email.
> You want a uniqueness to be enforced in the database, for the combination
> of first and last name.
> I don't know of a way to do this with the DAL in web2py - if there is, i'd
> love to hear about it.
>
>
You can write this rule with this command that you create on the table
: CREATE UNIQUE INDEX name ON table (column [, ...]);
And you can use pgAdmin to send it to the server and check that it
effectively applyed
Ref.: http://www.postgresql.org/docs/9.1/static/indexes-unique.html

And you are rigth that is not really supported with DAL, but you can use
your imagination... You could use db.table.field.compute to compute a new
concatenated column formed from you 3 field and create a validator for this
column that enforce uniqueness of this field petty easy isn't it??

And I would do both of these solution at the same time, in order to make
sure web2py don't try to create a duplicated entry, and at postgres level
to make there is no duplicated entry. There is an other reason to make
both, to avoid web2py raising tikect if app try to create a duplicates...
If there is no rule in your app to prevent duplicate database will return
error and web2py will raise a ticket because he don't know what to do.
Anyway, it is always a good idea to make sure that your database is full
proof even if you app is already OK. Because imagine you want to use an
other framework then web2py in the future, you would not mess up your data
with you new app in the new framework that do not not yet that the 3
columns should be unique together.

My programmer raised this concern a year ago in these forums, and she was
> ridiculed.
> I don't this this is such a "non-trivial" need in production, as to be
> ridiculed...
> It's actually a pretty common and very useful feature.
>
> Perhaps not every database supports it, but so what?
> I think enough people who use web2py in production use it in conjunction
> with PostgreSQL, to justify the merit of such a feature-request.
>
>
I don't think this is a feature... You need to wrote your own solution for
that the I suggest you self. I think Massimo try the best he can (with the
help of the community) to make DAL feel as most as possible like SQL,
but DAL is not SQL...

Richard


> But until then, and until all other unsupported DAL features exist, the
> usage of phpPGadmin/PgAdminIII for PostgreSQl is a necessity - regardless
> of OS.
> So I would really appreciate any help in that direction.
>
> Thank you.
>
>
> On Sunday, December 30, 2012 8:36:44 PM UTC+2, Richard wrote:
>
>> Arnon,
>>
>> I test it with 12.04 server 64 bit under VirtualBox with windows 7 64 bit
>> as guest and it works fine. It surely work under ubuntu desktop, but not
>> tested. The purpose of the script is to deploy rapidly a new prod/stage
>> server with basic configuration that you can tweaks for your needs later.
>> Since you don't really require Nginx for develppment it make no sens to
>> install pgAdmin on the staging/prod server, you generally install it on
>> your dev system. You can install phpPGAdmin if you want, but when I try it
>> (very longtime ago, may have change) it was not the same quality of
>> phpmyadmin, just for you to know that. I let you find your way to install
>> it (google...).
>>
>> Default postgres database name is redmine and user name for redemine is
>> redmine and the password is the one you enter when the script ask for it.
>>
>> You can, try it with 12.10, but I prefer 12.04 since it LTS and I don't
>> want to setup new environnement in less than a year.
>>
>> Richard
>>
>>
>> On Sun, Dec 30, 2012 at 1:26 PM, Richard Vézina <ml.richa...@gmail.com>wrote:
>>
>>> I will be glad, if you want to...
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>> On Fri, Dec 28, 2012 at 11:12 PM, Massimo Di Pierro <
>>> massimo....@gmail.com> wrote:
>>>
>>>> Would you suggest we include it in web2py/scripts/?
>>>>
>>>>
>>>> On Friday, 28 December 2012 14:17:12 UTC-6, Richard wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>> This is a new year gift for the one who would use Redmine beside
>>>>> web2py...
>>>>>
>>>>> :)
>>>>>
>>>>> The script is largely base on new Niphold web2py nginx deployment
>>>>> script (https://groups.google.com/**for**um/?fromgroups=#!searchin/**
>>>>> web2**py/nginx$20niphold/web2py/**15J3**T35_K_w/v_t1099dIf4J<https://groups.google.com/forum/?fromgroups=#!searchin/web2py/nginx$20niphold/web2py/15J3T35_K_w/v_t1099dIf4J>
>>>>> ).
>>>>>
>>>>> I spend many hours write it, test it and debug Redmine, so I copyright
>>>>> it and distribute it under CC without commercial use.
>>>>>
>>>>> Executing it in a fresh Ubuntu 12.04 server you will get :
>>>>> - Latest Redmine stable (2.2.0 from http://rubyforge.org),
>>>>> - Rails (3.2.9 from GEM)
>>>>> - Ruby (ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux])
>>>>> (Ubuntu ruby-dev package that should correspond to the latest stable Ruby)
>>>>> - working with Unicorn (latest stable from GEM),
>>>>> - web2py (latest stable)
>>>>> - uWSGI (I think latest stable), start in Emperor mode
>>>>> - Nginx (Ubuntu default)
>>>>> - PostgreSQL (Ubuntu default)
>>>>> - Redmine database will be installed in PostgreSQL
>>>>> - Self Signed SSL Certificat
>>>>>
>>>>> I try to make the script asking all the question at the beginning of
>>>>> the installation process just after launch it, but there is a confirmation
>>>>> asked during execution where you have to choose which language to use for
>>>>> the Redmine default values. Just hit enter you will get English Redmine
>>>>> default values.
>>>>>
>>>>> At the end of the execution, you should access your sever like this :
>>>>>
>>>>> http://IPADSRESS/
>>>>> # web2py Welcome should appear
>>>>> http://IPADSRESS/redmine
>>>>> # Redmine!
>>>>>
>>>>> Please report issue, submit improvement or post any comment here, and
>>>>> I will be glad to improve the script.
>>>>>
>>>>> Happy new year to all!
>>>>>
>>>>> Richard
>>>>>
>>>>  --
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>  --
>
>
>
>

-- 



Reply via email to