IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gui_aplicacion')
BEGIN
	EXEC [dbo].[_ini_creartabla] 'gui_aplicacion', 0
END
GO

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'gui_funcionalidad' AND COLUMN_NAME = 'id_aplicacion')
BEGIN
	ALTER TABLE [gui_funcionalidad]
	ADD [id_aplicacion] INT NOT NULL
	DEFAULT 0
	FOREIGN KEY ([id_aplicacion]) REFERENCES [gui_aplicacion](id)
END
GO
