219 int change_count = 0;
234 infoCallback(
string str,
int ac, *
string type, *
string name, *
string table, *
string new_name, *
string info);
305 AbstractDatasource
ds;
334 constructor(AbstractDatasource n_ds, *
string dts, *
string its, *
hash opts);
346 AbstractDatasource getDatasource();
350 AbstractDatabase getDatabase();
368 logProgress(
string str);
379 int align(
bool force =
False,
int verbose = 0);
383 drop(
bool force =
False,
int verbose = 0);
391 *
hash getIndexOptions();
399 *
hash getCreationOptions();
406 *
hash getColumnOptions();
420 *
hash getSequences();
434 *
hash getFunctions();
441 *
hash getProcedures();
455 *
hash getMaterializedViews();
462 *
hash getStrictReferenceDataHash();
469 *
hash getReferenceDataHash();
476 *
hash getCreateOnlyReferenceData();
483 *
hash getInsertOnlyReferenceData();
487 private abstract string getNameImpl();
490 private abstract string getVersionImpl();
495 private *
hash getIndexOptionsImpl();
501 private *
hash getColumnOptionsImpl();
507 private *
hash getGenericOptionsImpl();
513 private *
hash getTablesImpl();
519 private *
hash getSequencesImpl();
525 private *
hash getTypesImpl();
531 private *
hash getFunctionsImpl();
537 private *
hash getProceduresImpl();
543 private *
hash getPackagesImpl();
549 private *
hash getMaterializedViewsImpl();
555 private *
hash getStrictReferenceDataHashImpl();
561 private *
hash getReferenceDataHashImpl();
567 private *
hash getCreateOnlyReferenceDataImpl();
573 private *
hash getInsertOnlyReferenceDataImpl();
580 private bool checkExistence();
584 private bool checkFirstTimeInstall();
588 private bool checkDropSchema(
bool force);
592 private bool checkUpdateSchema(
bool force, reference initial_schema_info);
596 private doPostAlignment(Tables table_cache,
bool first_time_install, *
hash initial_schema_info);
600 private int getUpsertStrategy(
bool first_time_install);
604 private postDataActions(
bool first_time_install);
608 private doTable(AbstractTable table,
list rows,
int upsert_strategy,
bool delete_others,
int verbose, reference sh);
614 static list getRows(*softlist l);
617 static hash combineOptions(*
hash h);
649 constructor(AbstractDatasource ds, *
string dts, *
string its, *
hash opts) ;
653 private *softstring getSchemaVersion();
657 private bool checkDropSchema(
bool force);
661 private bool checkUpdateSchema(
bool force, reference initial_schema_info);
665 private bool checkUpgrade(
string current_version);
669 private bool checkDowngrade(
string current_version);
676 private string getVersionTable();
683 private string getVersionColumn();
690 private hash getVersionWhere();
694 private abstract string getVersionTableImpl();
697 private abstract string getVersionColumnImpl();
700 private abstract hash getVersionWhereImpl();
hash c_timestamp(bool notnull=False, *string comment)
returns a column hash for a TIMESTAMP column
hash c_date(bool notnull=False, *string comment)
returns a column hash for a DATE column
hash getCallbacks(bool force=False)
returns a callback option hash usable with SqlUtil schema operations
infoCallback(string str, int ac, *string type, *string name, *string table, *string new_name, *string info)
this is the informational callback method for schema operations
AbstractDatasource ds
the datasource for the schema
Definition: Schema.qm.dox.h:305
string name
the name of the schema
Definition: Schema.qm.dox.h:288
*hash column_options
column options, as provided by getColumnOptions()
Definition: Schema.qm.dox.h:300
hash c_varchar(int size, bool notnull=False, *string comment)
returns a column hash for a VARCHAR column
hash callback_opts
callback options plus all options
Definition: Schema.qm.dox.h:315
*hash index_options
index options, as provided by getIndexOptions()
Definition: Schema.qm.dox.h:296
sqlCallback(string str)
this is the SQL callback method for schema operations
string version_column
the name of the column containing the version string
Definition: Schema.qm.dox.h:637
*string data_ts
explicit data tablespace name
Definition: Schema.qm.dox.h:321
const C_NULL
Helper constant for column hash functions with "NULL" constraint for better readability.
Definition: Schema.qm.dox.h:83
constructor(AbstractSchema sc, int v=0)
creates the callback object from the given arguments
this namespace contains all public definitions in the Schema module
Definition: Schema.qm.dox.h:81
this class extends Schema::AbstractSchema by providing version logic based on a schema version string...
Definition: Schema.qm.dox.h:630
*hash creation_options
creation options, as provided by getCreationOptions()
Definition: Schema.qm.dox.h:298
hash c_char(int size, bool notnull=False, *string comment)
returns a column hash for a CHAR column
hash schema
the schema template, as assembled from method callbacks providing schema element definitions ...
Definition: Schema.qm.dox.h:293
this class provides callback support for schema operations
Definition: Schema.qm.dox.h:213
string version_table
the name of the table containing the version string
Definition: Schema.qm.dox.h:635
SqlUtil::Database db
the Database object for the schema
Definition: Schema.qm.dox.h:310
code info_callback
the info callback for schema operations; can be used for explicit logging
Definition: Schema.qm.dox.h:318
string version
the version of the schema
Definition: Schema.qm.dox.h:290
const C_NOT_NULL
Helper constant for column hash functions with "NOT NULL" constraint for better readability.
Definition: Schema.qm.dox.h:85
*hash all_options
combined creation and column options
Definition: Schema.qm.dox.h:302
string drv
the name of the database driver
Definition: Schema.qm.dox.h:307
hash version_where
a where clause hash defining the row where the schema version string is located
Definition: Schema.qm.dox.h:639
hash pure_callback_opts
just callback options
Definition: Schema.qm.dox.h:313
hash c_number(bool notnull=False, *string comment)
returns a column hash for a NUMBER or NUMERIC column
*string index_ts
explicit index tablespace name
Definition: Schema.qm.dox.h:324
nothing sqlForceCallback(string str)
this is the SQL callback method for forced schema operations
the AbstractSchema class is a base class to assist with automatic schema management ...
Definition: Schema.qm.dox.h:283
hash c_int(bool notnull=False, *string comment)
returns a column hash for an INT column