CREATE TABLE peer_mark_results (
	peer_mark_result_id int NOT NULL,
	resource_id int NOT NULL,
	user_id int NOT NULL,
	status int NOT NULL,
	mark int,
	when_marked TIMESTAMP,
	CONSTRAINT PK_peerm_results PRIMARY KEY
	(
		peer_mark_result_id
	),
	CONSTRAINT FK_peerm_result_to_objects FOREIGN KEY
	(
		peer_mark_result_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_pm_result_to_resources FOREIGN KEY
	(
		resource_id
	) REFERENCES resources (
		resource_id
	),
	CONSTRAINT FK_pm_result_to_users FOREIGN KEY
	(
		user_id
	) REFERENCES users (
		user_id
	)
)
GO


INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(303,	'building2', 'peer_mark_results', 'org.bodington.assessment.PeerMarkerResult')
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 1, 'peer_mark_result_id', 'setPeerMarkerResultId', 'getPeerMarkerResultId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 1, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 2, 'resource_id', 'setResourceId', 'getResourceId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 3, 'user_id', 'setUserId', 'getUserId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 4, 'status', 'setStatus', 'getStatus', 'int', 'int', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 5, 'mark', 'setMark', 'getMark', 'java.lang.Integer', 'java.lang.Integer', 0, null, null, null )
GO

INSERT INTO fields (type, sequence, field, set_method_name, get_method_name, set_java_class, get_java_class, flags, foreign_type, set_method_name_foreign, get_method_name_foreign )
	VALUES(303, 6, 'when_marked', 'setWhenMarked', 'getWhenMarked', 'java.sql.Timestamp', 'java.sql.Timestamp', 0, null, null, null )
GO
