CREATE TABLE user_x509s (
	user_x509_id int NOT NULL,
	user_id int NOT NULL ,
	serialized_certificate LONG VARCHAR NULL ,
        serial_number int NULL,
        distinguished_name VARCHAR(255),

	CONSTRAINT PK_user_x509s PRIMARY KEY
	(
		user_x509_id
	),
	CONSTRAINT FK_user_x509s_to_objects FOREIGN KEY
	(
		user_x509_id
	) REFERENCES objects (
		id
	),
	CONSTRAINT FK_user_x509s_to_users FOREIGN KEY
	(
		user_id
	) REFERENCES users (
		user_id
	)
)
GO

INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES( 58, null, 'user_x509s', 'org.bodington.server.realm.UserX509')
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(58, 1, 'user_x509_id', 'setUserX509Id', 'getUserX509Id', '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(58, 2, '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(58, 3, 'serialized_certificate', 'setSerializedCertificate', 'getSerializedCertificate', '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(58, 4, 'serial_number', 'setSerialNumber', 'getSerialNumber', '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(58, 5, 'distinguished_name', 'setDistinguishedName', 'getDistinguishedName', 'java.lang.String', 'java.lang.String', 0, null, null, null )
GO

