Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Re: Automatically altering tables from different schema's

by mpeppler (Vicar)
on Jan 08, 2004 at 18:14 UTC ( #319891=note: print w/replies, xml ) Need Help??

in reply to Re: Automatically altering tables from different schema's
in thread Automatically altering tables from different schema's

I want to point out that the problem is more subtle than you may think
Indeed. The difference between two versions of a table can be missing columns, which is fairly easy to manage, or more subtle things like NULL/NOT NULL, primary key, constraints, and a host of other things.

Consider Sybase's CREATE TABLE syntax:

create table [database .[owner ].]table_name (column_name datatype [default {constant_expression | user | null}] {[{identity | null | not null}] [off row | [ in row [ (size_in_bytes) ] ] [[constraint constraint_name ] {{unique | primary key} [clustered | nonclustered] [asc | desc] [with { fillfactor = pct, max_rows_per_page = num_rows, } reservepagegap = num_pages }] [on segment_name] | references [[database .]owner .]ref_table [(ref_column )] [match full] | check (search_condition)}]} [match full]... | [constraint constraint_name] {{unique | primary key} [clustered | nonclustered] (column_name [asc | desc] [{, column_name [asc | desc]}...]) [with { fillfactor = pct, max_rows_per_page = num_rows , reservepagegap = num_pages } ] [on segment_name] |foreign key (column_name [{,column_name}...]) references [[database.]owner.]ref_table [(ref_column [{, ref_column}...])] [match full] | check (search_condition) ... } [{, {next_column | next_constraint}}...]) [lock {datarows | datapages | allpages }] [with { max_rows_per_page = num_rows, exp_row_size = num_bytes, reservepagegap = num_pages, identity_gap = value } ] [on segment_name ] [ [ external table ] at pathname ]
Obviously, creating an UPDATE TABLE request that will automatically make the two versions of a table identical becomes non-trivial if all of these syntax elements need to be handled.

Replies are listed 'Best First'.
Re: Re: Re: Automatically altering tables from different schema's
by liz (Monsignor) on Jan 08, 2004 at 19:33 UTC
    I was going to go for MySQL and SQLite, because those are the itches that I need to scratch. Other will have to add their favourite database drivers themselves ;-)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://319891]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-06-18 23:56 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.