init_repository (Vapor::RepositoryManager)

    # File vapor/repositorymgr.rb, line 30
        def init_repository

          # make sure that the database is clean (== empty)
          result = @dbh.execute( "SELECT  relname FROM pg_class WHERE relname !~ '^pg_'")
          if result.fetch then
            raise BackendInconsistentError, "repository database is not empty prior to initialization"
          end

          # now let's start creating
          classmetadata = [ ['_oid', 'BIGINT PRIMARY KEY'],
                            ['_name', 'VARCHAR(255)'],
                            ['_superclass', 'VARCHAR(255)'],
                            ['_table', 'VARCHAR(64)']
                          ]
          create_table( ":Vapor::ClassMetaData", classmetadata )

          attributemetadata = [ ['_oid', 'BIGINT'],
                                ['_name', 'VARCHAR(255)'],
                                ['_type', 'VARCHAR(16)'],
                                ['_array', 'BOOLEAN']
                              ]
          create_table( ":Vapor::AttributeMetaData", attributemetadata )

          objectlist = [ ['_oid', 'BIGINT PRIMARY KEY'],
                         ['_class', 'VARCHAR(64)']
                       ]
          create_table( ":Vapor::ObjectList", objectlist )

          repositoryinfo = [ ['name', 'TEXT'],
                             ['value', 'TEXT']
                           ]
          create_table( ":Vapor::RepositoryInfo", repositoryinfo )
          @dbh.execute( %!INSERT INTO ":Vapor::RepositoryInfo" (name, value) VALUES ('created', '#{Time.now.to_s}' )! )
          @dbh.execute( %!INSERT INTO ":Vapor::RepositoryInfo" (name, value) VALUES ('last-modified', '#{Time.now.to_s}' )! )
          @dbh.execute( %!INSERT INTO ":Vapor::RepositoryInfo" (name, value) VALUES ('schema-version', #{SchemaVersion} )! )

          @dbh.execute( 'CREATE SEQUENCE ":Vapor::oid_high" MAXVALUE 281474976710655' )

          # remember Repository initialized
          @repository_ok = true

          # insert metadata about TransactionLog
          tlog = ClassMetaData.new( Vapor::TransactionLog.name, "", ":" + Vapor::TransactionLog.name )
          tlog.attributes.concat( Vapor::TransactionLog.metadata )
          addclass( tlog )

        end