Hi Anuruddha,

Understood the problem. Database is a special case and should be handled at
the code level. Retrieve all databases for a tenant and check wether the
name exists. You have to check the uniqueness for a tenant, rather than
changing the uniqueness constraint. So I would introduce a new method
"isResourceExistForTenant" that would check whether the resource exist for
tenant. I would not change the uniqueness constraint of the database.

thanks,
dimuthu

On Thu, Jan 8, 2015 at 9:21 PM, Anuruddha Premalal <[email protected]>
wrote:

> Hi All,
>
> If the RESOURCE_TYPE is DATABASE, we cannot have the same name for
> different applicaions given that we are pointing to a single DB for a given
> environment. In all the other cases we can use (APPLICATION_ID,
> RESOURCE_TYPE, RESOURCE_NAME, ENVIRONMENT) as the unique.
>
> So in DATABSE resource type, it should be RESOURCE_NAME, ENVIRONMENT
>
> On Thu, Jan 8, 2015 at 8:18 PM, Dimuthu Leelarathne <[email protected]>
> wrote:
>
>> Hi all,
>>
>> I ran through the complete script. Adding to what Danushka said the
>> uniqueness should be (APPLICATION_ID, RESOURCE_TYPE, RESOURCE_NAME,
>> ENVIRONMENT)
>>
>> thanks,
>> dimuthu
>>
>> On Thu, Jan 8, 2015 at 5:36 PM, Danushka Fernando <[email protected]>
>> wrote:
>>
>>> Moved to dev@ since this is a dev matter.
>>>
>>> I think what unique should be is (APPLICATION_ID, RESOURCE_NAME,
>>> ENVIRONMENT). No point in making RESOURCE_NAME field alone unique.
>>> Because an user should be able to create a resource with same name in a
>>> different environement/stage or different application.
>>>
>>> Thanks & Regards
>>> Danushka Fernando
>>> Software Engineer
>>> WSO2 inc. http://wso2.com/
>>> Mobile : +94716332729
>>>
>>> On Thu, Jan 8, 2015 at 4:35 PM, Anuruddha Premalal <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> In creating a datadabse/datasource/databse_user/databse_template we
>>>> update the AF_RESOURCE table(in afdb) with the following parameters.
>>>>
>>>> APPLICATION_ID
>>>> RESOURCE_TYPE
>>>> RESOURCE_NAME
>>>> ENVIRONMENT
>>>> DESCRIPTION
>>>>
>>>> Since duplication should not be allowed in any of the appfactory
>>>> resources, shall we make the RESOURCE_NAME field unique?. This will require
>>>> a data migration for cloud as well.
>>>>
>>>>
>>>> Regards,
>>>> --
>>>> *Anuruddha Premalal*
>>>> Software Eng. | WSO2 Inc.
>>>> Mobile : +94710461070
>>>> Web site : www.regilandvalley.com
>>>>
>>>>
>>>
>>
>>
>> --
>> Dimuthu Leelarathne
>> Architect & Product Lead of App Factory
>>
>> WSO2, Inc. (http://wso2.com)
>> email: [email protected]
>> Mobile : 0773661935
>>
>> Lean . Enterprise . Middleware
>>
>
>
>
> --
> *Anuruddha Premalal*
> Software Eng. | WSO2 Inc.
> Mobile : +94710461070
> Web site : www.regilandvalley.com
>
>


-- 
Dimuthu Leelarathne
Architect & Product Lead of App Factory

WSO2, Inc. (http://wso2.com)
email: [email protected]
Mobile : 0773661935

Lean . Enterprise . Middleware
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to