Recreate index after updating table

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18454 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2009-11-30 23:21:50 +00:00
parent 12069d5947
commit bf7a7a7497
2 changed files with 12 additions and 21 deletions

View File

@ -636,13 +636,12 @@ static void
create_slots_tables( GncSqlBackend* be )
{
gint version;
gboolean ok;
g_return_if_fail( be != NULL );
version = gnc_sql_get_table_version( be, TABLE_NAME );
if( version == 0 ) {
gboolean ok;
(void)gnc_sql_create_table( be, TABLE_NAME, TABLE_VERSION, col_table );
ok = gnc_sql_create_index( be, "slots_guid_index", TABLE_NAME, obj_guid_col_table );
@ -652,6 +651,10 @@ create_slots_tables( GncSqlBackend* be )
} else if( version == 1 ) {
/* Upgrade 64-bit int values to proper definition */
gnc_sql_upgrade_table( be, TABLE_NAME, col_table );
ok = gnc_sql_create_index( be, "slots_guid_index", TABLE_NAME, obj_guid_col_table );
if( !ok ) {
PERR( "Unable to create index\n" );
}
(void)gnc_sql_set_table_version( be, TABLE_NAME, TABLE_VERSION );
}
}

View File

@ -490,25 +490,13 @@ create_transaction_tables( GncSqlBackend* be )
}
} else if( version < SPLIT_TABLE_VERSION ) {
/* Perform the various upgrades based on the current version number */
switch( version ) {
case 1:
/* Upgrade 64 bit int handling */
gnc_sql_upgrade_table( be, SPLIT_TABLE, split_col_table );
/* fallthrough */
case 2:
ok = gnc_sql_create_index( be, "splits_tx_guid_index", SPLIT_TABLE, guid_col_table );
if( !ok ) {
PERR( "Unable to create index\n" );
}
/* fallthrough */
case 3:
/* Split reconcile_date can be NULL */
gnc_sql_upgrade_table( be, SPLIT_TABLE, split_col_table );
/* Upgrade:
1->2: 64 bit int handling
3->4: Split reconcile date can be NULL */
gnc_sql_upgrade_table( be, SPLIT_TABLE, split_col_table );
ok = gnc_sql_create_index( be, "splits_tx_guid_index", SPLIT_TABLE, guid_col_table );
if( !ok ) {
PERR( "Unable to create index\n" );
}
(void)gnc_sql_set_table_version( be, SPLIT_TABLE, SPLIT_TABLE_VERSION );
}