On Wednesday, July 11, 2018 at 11:54:39 AM UTC-7, Charles Monteiro wrote:
>
> So in an effort to provide so that our product can support multiple 
> database vendors, I"m trying to leverage Sequel's schema modification api 
> such as create_table to develop one schema definition that can create the 
> specified tables depending on the target RDMS.
>
> So for example here's a typical create table spec from our Oracle 
> schema.sql
>
> /******************************** CLIENT TABLE 
> ***********************************/
>> DROP PUBLIC SYNONYM tb_client ; 
>> DROP TABLE tbadmin1.tb_client ;
>> CREATE TABLE tbadmin1.tb_client 
>> ( 
>>  Status                      char(01)               not null,
>>  Last_Update             numeric(14,7)   not null,
>>  Client_Id                      varchar2(04)         not null,
>>  Name1                          varchar2(40),
>>  Name2                          varchar2(40),
>>  Addr1                          varchar2(40),
>>  Addr2                          varchar2(40),
>>  City                           varchar2(20),
>>  State                          char(02),
>>  Zip                            varchar2(10),
>>  Country                     varchar2(20),
>>  Contact_Name                   varchar2(40),
>>  Phone_Nbr                      varchar2(14),
>>  Email_Addr           varchar2(60),
>>  Bbts_Firm_Id           varchar2(04),
>>  CONSTRAINT tk_client PRIMARY KEY ( client_id ) 
>>       USING INDEX TABLESPACE tb_acc_indx
>> )
>> TABLESPACE tb_acc_data;
>> CREATE PUBLIC SYNONYM tb_client FOR tbadmin1.tb_client ; 
>> GRANT SELECT ON tb_client TO tblaze_user ; 
>>
>>
> given Sequel I came up with this:
>
> DB.create_table!(:tb_client) do
>>
>>   String :status, fixed: true, size: 1
>>   BigDecimal :last_update, size: [14, 7]
>>   String :client_id, size: 4, primary_key: true, 
>> primary_key_constraint_name: 'tk_client'
>>   String :name1, size: 40
>>   String :name2, size: 40
>>   String :addr1, size: 40
>>   String :city, size: 20
>>   String :state, fixed: true, size: 2
>>   String :country, size: 20
>>   String :contact_name, size: 40
>>   String :phone_nbr, size: 14
>>   String :email_addr, size: 60
>>   String :bbts_firm_id, size: 4
>>
>>   index :client_id, name: 'tb_acc_indx'
>>
>>
>> end
>>
>>
> I can't seem to find a Sequel supported mechanism for :
>
> TABLESPACE tb_acc_data;
> CREATE PUBLIC SYNONYM tb_client FOR tbadmin1.tb_client ; 
> GRANT SELECT ON tb_client TO tblaze_user ; 
>
>
> Is it too ambitious to think that I can have one schema definition file 
> across multiple RDMS ?
>

Not really. You may need a "case DB.database_type" expression somewhere if 
you have code that Sequel doesn't abstract, such as tablespaces, synonyms, 
and permissions.  Sequel did recently add support for a :tablespace option 
on PostgreSQL, and support could be added for Oracle and potentially other 
databases.  I don't think I want to have Sequel handle permissions in a 
cross-database banner, and synonyms appear to be an Oracle specific feature.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to