 	end;
 $test$ language plpgsql;
 
+create or replace function test_users_table_groupinvite_exists()
+returns setof text as $test$
+	begin
+		return next has_table('users', 'group_invite',
+			'Needs a group invite table.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_link_exists()
+returns setof text as $test$
+	begin
+		return next has_column('users', 'group_invite', 'link',
+			'Group invite needs a link column.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_link_is_uuid()
+returns setof text as $test$
+	begin
+		return next col_type_is('users', 'group_invite', 'link', 'uuid',
+			'Group invite''s link needs to be uuid');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_link_is_pk()
+returns setof text as $test$
+	begin
+		return next col_is_pk( 'users', 'group_invite', 'link',
+			'Link needs to be the primary key on group_invite.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_groupid_exists()
+returns setof text as $test$
+	begin
+		return next has_column('users', 'group_invite', 'group_id',
+			'Group invite needs a group id column.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_groupid_is_uuid()
+returns setof text as $test$
+	begin
+		return next col_type_is('users', 'group_invite', 'group_id', 'uuid',
+			'Group invite group id needs to be uuid');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_groupid_is_fk()
+returns setof text as $test$
+	begin
+		return next fk_ok('users', 'group_invite', 'group_id',
+			'users', 'group', 'id',
+			'Group invite group id needs to be linked to group');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_userid_exists()
+returns setof text as $test$
+	begin
+		return next has_column('users', 'group_invite', 'user_id',
+			'Group invite needs a user id column.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_userid_is_uuid()
+returns setof text as $test$
+	begin
+		return next col_type_is('users', 'group_invite', 'user_id', 'uuid',
+			'Group invite user id needs to be uuid');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_userid_is_fk()
+returns setof text as $test$
+	begin
+		return next fk_ok('users', 'group_invite', 'user_id',
+			'users', 'user', 'id',
+			'Group invite user id needs to be linked to group');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_refused_exists()
+returns setof text as $test$
+	begin
+		return next has_column('users', 'group_invite', 'refused',
+			'Group invite needs a refused column.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_refused_is_boolean()
+returns setof text as $test$
+	begin
+		return next col_type_is('users', 'group_invite', 'refused', 'boolean',
+			'Group invite user id needs to be boolean');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_colume_refused_has_default()
+returns setof text as $test$
+	begin
+		return next col_default_is('users', 'group_invite', 'refused',
+			'false'::boolean,
+			'The group invite refused should default to false.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_expire_exists()
+returns setof text as $test$
+	begin
+		return next has_column('users', 'group_invite', 'expire',
+			'Group invite needs a expiration column.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_column_expire_is_timestamp()
+returns setof text as $test$
+	begin
+		return next col_type_is('users', 'group_invite', 'expire', 
+			'timestamp with time zone',
+			'Group invite user id needs to be boolean');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_table_groupinvite_colume_expire_has_default()
+returns setof text as $test$
+	begin
+		return next col_default_is('users', 'group_invite', 'expire',
+			$$(now() + '1 mon'::interval)$$,
+			'The group invite expire should default to one month.');
+	end;
+$test$ language plpgsql;
+
+create or replace function test_users_function_addgroupuser_exists()
+returns setof text as $test$
+	begin 
+		return next function_returns('users', 'group_user_add',
+			array['text', 'text', 'text'], 'uuid', 
+			'There needs to be a function to add users to a group.');
+		return next is_definer('users', 'group_user_add', 
+			array['text', 'text', 'text'], 
+			'Logout needs to securite definer access.');
+	end;
+$test$ language plpgsql;
+
 create or replace function correct_users()
 returns setof text as $func$
 	declare 

				on delete cascade
				on update cascade;
			return next 'Linked the session id to the users.';
		end if;
		
		drop trigger if exists protect_anonymous on users.user;

		set search_path = users, pg_temp;
		return next 'Created function users.logout.';
		
		create or replace function users.group_user_add(
			sessid		text,
			groupname	text,
			username	text)
		returns uuid as $$
			begin
				return public.uuid_nil();
			end;
		$$ language plpgsql security definer
		set search_path = users, pg_temp;
		return next 'Created function users.group_user_add.';
		
		create trigger protect_anonymous
			before update or delete
			on users.user
