diff options
author | Jesse McConnell <jmcconnell@apache.org> | 2007-02-26 22:10:41 +0000 |
---|---|---|
committer | Jesse McConnell <jmcconnell@apache.org> | 2007-02-26 22:10:41 +0000 |
commit | 3600ec58449dcf3999ed7b5bd609fd523cbd9d2e (patch) | |
tree | 10878d6f9b13d6d43843415e26d561d91ad69a0d /archiva-database/src | |
parent | 78afb73f95692bf5076999c8b1fc76c0c5a057ca (diff) | |
download | archiva-3600ec58449dcf3999ed7b5bd609fd523cbd9d2e.tar.gz archiva-3600ec58449dcf3999ed7b5bd609fd523cbd9d2e.zip |
added definitions for other tables and fixed up naming conventions
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@512034 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-database/src')
4 files changed, 48 insertions, 22 deletions
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/IbatisMetadataStore.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/IbatisMetadataStore.java index aaa78c90c..781b2fe30 100644 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/IbatisMetadataStore.java +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/IbatisMetadataStore.java @@ -63,11 +63,17 @@ public class IbatisMetadataStore // Create the tables getLogger().info( "Creating metadata keys instance table" ); - sqlMap.update( "createMetadataKeyTable", null ); + sqlMap.update( "initializeMetadataKeyTable", null ); getLogger().info( "Creating repository metadata instance table" ); - sqlMap.update( "createRepositoryMetadataTable", null ); + sqlMap.update( "initializeRepositoryMetadataTable", null ); + getLogger().info( "Creating repository health metadata instance table" ); + sqlMap.update( "initializeHealthMetadataTable", null ); + + getLogger().info( "Creating repository versions metadata instance table" ); + sqlMap.update( "initializeVersionsMetadataTable", null ); + sqlMap.commitTransaction(); } catch ( SQLException e ) diff --git a/archiva-database/src/main/resources/ibatis-config.xml b/archiva-database/src/main/resources/ibatis-config.xml index b3b222db1..cec13f491 100644 --- a/archiva-database/src/main/resources/ibatis-config.xml +++ b/archiva-database/src/main/resources/ibatis-config.xml @@ -23,6 +23,6 @@ </dataSource> </transactionManager> - <sqlMap resource="org/apache/maven/archiva/database/CreateDatabases.xml"/> + <sqlMap resource="org/apache/maven/archiva/database/CreateTables.xml"/> <sqlMap resource="org/apache/maven/archiva/database/MetadataKey.xml"/> </sqlMapConfig>
\ No newline at end of file diff --git a/archiva-database/src/main/resources/org/apache/maven/archiva/database/CreateTables.xml b/archiva-database/src/main/resources/org/apache/maven/archiva/database/CreateTables.xml index 4d936a6ea..800e855d9 100644 --- a/archiva-database/src/main/resources/org/apache/maven/archiva/database/CreateTables.xml +++ b/archiva-database/src/main/resources/org/apache/maven/archiva/database/CreateTables.xml @@ -8,7 +8,7 @@ <!-- METADATA_KEYS is the index table for all other tables --> -<statement id="initalizeMetadataKeyTable"> +<statement id="initializeMetadataKeyTable"> CREATE TABLE MetadataKeys ( metadataKey integer generated always as identity ( start with 1 ) primary key, groupId varchar(100) not null, @@ -17,17 +17,37 @@ METADATA_KEYS is the index table for all other tables ) </statement> -<statement id="createRepositoryMetadataTable"> - CREATE TABLE StepInstance ( - repositoryId integer, - repositoryName varchar(100) not null, - latest varchar(100) not null, - release varchar(100) not null, - lastUpdated long not null, - snapshotTimestamp long not null, - snapshotBuildNumber long not null, - snapshotLocalCopy boolean, - primary key( repositoryId ), +<statement id="initializeRepositoryMetadataTable"> + CREATE TABLE RepositoryMetadata ( + metadataKey integer not null, + id integer generated always as identity ( start with 1 ) primary key, + repositoryId varchar(100) not null, + latest varchar(100) not null, + release varchar(100) not null, + lastUpdated integer not null, + snapshotTimestamp integer not null, + snapshotBuildNumber integer not null, + snapshotLocalCopy char(1) not null, + foreign key( metadataKey ) references MetadataKeys( metadataKey ) + ) +</statement> + +<statement id="initializeHealthMetadataTable"> + CREATE TABLE HealthMetadata ( + metadataKey integer not null, + id integer generated always as identity ( start with 1 ) primary key, + processId varchar(100) not null, + problemId varchar(100) not null, + message varchar(8000) not null, + foreign key( metadataKey ) references MetadataKeys( metadataKey ) + ) +</statement> + +<statement id="initializeVersionsMetadataTable"> + CREATE TABLE VersionMetadata ( + metadataKey integer not null, + id integer generated always as identity ( start with 1 ) primary key, + version varchar(100) not null, foreign key( metadataKey ) references MetadataKeys( metadataKey ) ) </statement> diff --git a/archiva-database/src/main/resources/org/apache/maven/archiva/database/MetadataKey.xml b/archiva-database/src/main/resources/org/apache/maven/archiva/database/MetadataKey.xml index 86bbcd4a2..06bce40e0 100644 --- a/archiva-database/src/main/resources/org/apache/maven/archiva/database/MetadataKey.xml +++ b/archiva-database/src/main/resources/org/apache/maven/archiva/database/MetadataKey.xml @@ -7,17 +7,17 @@ <select id="getMetadataKey" resultClass="org.apache.maven.archiva.database.key.MetadataKey"> SELECT - METADATA_KEY as id - GROUP_ID as groupId, - ARTIFACT_ID as artifactId, - VERSION as version, - FROM METADATA_KEYS - WHERE METADATA_KEY = #value# + metadataKey as id + groupId as groupId, + artifactId as artifactId, + version as version, + FROM MetadataKeys + WHERE metadataKey = #value# </select> <insert id="addMetadataKey" parameterClass="org.apache.maven.archiva.database.key.MetadataKey"> INSERT INTO - METADATA_KEYS ( GROUP_ID, ARTIFACT_ID, VERSION_ID ) + MetadataKeys ( groupId, artifactId, version ) VALUES (#groupId#, #artifactId#, #version# ) </insert> |