CREATE TABLE user_event_setups (
	user_event_setup_id int NOT NULL ,
	user_id int NOT NULL ,
	cutoff_time TIMESTAMP NOT NULL ,
	email_cutoff_time TIMESTAMP NOT NULL ,
	email_frequency int NOT NULL ,
	CONSTRAINT PK_user_event_setups PRIMARY KEY
	(
		user_event_setup_id
	),
	CONSTRAINT UQ_user_event_setups_1 UNIQUE
	(
		user_id
	),
	CONSTRAINT FK_usr_evnt_setps_to_objects FOREIGN KEY
	(
		user_event_setup_id
	) REFERENCES objects (
		id
	)
)
GO


INSERT INTO classes (type, db_name, table_name, java_class)
	VALUES(17,	'building2', 'user_event_setups', 'org.bodington.server.events.UserEventSetup')
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(17, 1, 'user_event_setup_id', 'setUserEventSetupId', 'getUserEventSetupId', '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(17, 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(17, 3, 'cutoff_time', 'setCutoffTime', 'getCutoffTime', 'java.sql.Timestamp', 'java.sql.Timestamp', 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(17, 4, 'email_cutoff_time', 'setEMailCutoffTime', 'getEMailCutoffTime', 'java.sql.Timestamp', 'java.sql.Timestamp', 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(17, 5, 'email_frequency', 'setEMailFrequency', 'getEMailFrequency', 'int', 'int', 0, null, null, null )
GO

