예제 #1
0
 internal static void EnsureTableSchema(SQLiteConnection connection)
 {
     if (!VariablesTable.DoesTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. It may have been created with an early vesion of IsabelDb or it may not even be an IsabelDb file. Are you sure the path is correct?", VariablesTable.TableName));
     }
     if (!TypeModel.DoesTypeTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. The table may have been deleted or this may not even be an IsabelDb file. Are you sure the path is correct?", TypeModel.TypeTableName));
     }
     if (!CollectionsTable.DoesTableExist(connection))
     {
         throw new IncompatibleDatabaseSchemaException(string.Format("The database is missing the '{0}' table. The table may have been deleted or this may not even be an IsabelDb file. Are you sure the path is correct?", CollectionsTable.TableName));
     }
 }
예제 #2
0
        private static void CreateTablesIfNecessary(SQLiteConnection connection)
        {
            var hasTypesTable  = TypeModel.DoesTypeTableExist(connection);
            var hasStoresTable = CollectionsTable.DoesTableExist(connection);

            if (hasTypesTable && hasStoresTable)
            {
                return;
            }
            if (hasTypesTable != hasStoresTable)
            {
                throw new NotImplementedException("Something something incompatible");
            }

            CreateTables(connection);
        }