CREATE TABLE web_auth_user (
	web_auth_user_id int NOT NULL,
	user_id int NOT NULL ,
	user_name varchar (16) NOT NULL ,
	CONSTRAINT PK_web_auth_user PRIMARY KEY
	(
		web_auth_user_id
	),
	CONSTRAINT UQ_web_auth_user_user_id UNIQUE
	(
		user_id
	),
	CONSTRAINT UQ_web_auth_user_user_name UNIQUE
	(
		user_name
	),
	CONSTRAINT FK_web_auth_users_to_objects FOREIGN KEY
	(
		web_auth_user_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_web_auth_users_to_users FOREIGN KEY
	(
		user_id
	) REFERENCES users (
		user_id
	)
)
GO

INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(105,	'building2', 'web_auth_user', 'org.bodington.server.realm.WebAuthUser')
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(105, 1, 'web_auth_user_id', 'setWebAuthUserId', 'getWebAuthUserId', '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(105, 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(105, 3, 'user_name', 'setUserName', 'getUserName', 'java.lang.String', 'java.lang.String', 0, null, null, null )
GO


