CREATE TABLE pass_phrases (
	pass_phrase_id int NOT NULL,
	user_id int NOT NULL ,
	user_name varchar (16) NOT NULL ,
	pass_phrase varchar (64),
	CONSTRAINT PK_pass_phrases PRIMARY KEY
	(
		pass_phrase_id
	),
	CONSTRAINT UQ_user_id UNIQUE
	(
		user_id
	),
	CONSTRAINT UQ_user_name UNIQUE
	(
		user_name
	),
	CONSTRAINT FK_pass_phrases_to_objects FOREIGN KEY
	(
		pass_phrase_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_pass_phrases_to_users FOREIGN KEY
	(
		user_id
	) REFERENCES users (
		user_id
	)
)
GO

INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(2,	'building2', 'pass_phrases', 'org.bodington.server.realm.PassPhrase')
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(2, 1, 'pass_phrase_id', 'setPassPhraseId', 'getPassPhraseId', '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(2, 2, 'user_id', 'setUserId', 'getUserId', 'org.bodington.database.PrimaryKey', 'org.bodington.database.PrimaryKey', 2, 1, 'setUser', 'getUser' )
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(2, 3, 'user_name', 'setUserName', 'getUserName', 'java.lang.String', 'java.lang.String', 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(2, 4, 'pass_phrase', 'setPassPhrase', 'getPassPhrase', 'java.lang.String', 'java.lang.String', 0, null, null, null )
GO

