
    create table PULSE (
        [UUID] uniqueidentifier not null,
        [PLANTA_ID] uniqueidentifier not null,
        [PULSE_ID] varchar(50) not null,
        [PULSE_TYPE] varchar(50)
    );

    IF NOT EXISTS (SELECT * FROM SYS.INDEXES
       WHERE IS_PRIMARY_KEY = 1 AND OBJECT_ID IN
             (SELECT OBJECT_ID FROM SYS.TABLES WHERE NAME = 'PULSE'))
       alter table PULSE add constraint PID597DT597 primary key ([UUID]);

    alter table PULSE 
        add constraint DT597UUID_DEFAULT DEFAULT newid() FOR [UUID];

    alter table PULSE 
        add constraint DT597PLANTA_ID_NOT_NULL check([PLANTA_ID] is not null);

    alter table PULSE 
        add constraint DT597PULSE_ID_NOT_NULL check([PULSE_ID] is not null);

    alter table PULSE 
        add constraint DT597UUID_NOT_NULL check([UUID] is not null);

    alter table DT463 add PULSE_RELEVANT numeric(5,0);

    alter table DT463 add constraint DT463DI064945_DEFAULT DEFAULT 0 FOR [PULSE_RELEVANT];

    update DT463 set PULSE_RELEVANT = DEFAULT;


    create table PULSESUBSCRIPTION (
        [UUID] uniqueidentifier not null,
        [MAPPING] uniqueidentifier,
        [SUBSCRIPTION] varchar(50),
        [SUBSCRIPTION_TYPE] varchar(50)
    );

    IF NOT EXISTS (SELECT * FROM SYS.INDEXES
       WHERE IS_PRIMARY_KEY = 1 AND OBJECT_ID IN
             (SELECT OBJECT_ID FROM SYS.TABLES WHERE NAME = 'PULSESUBSCRIPTION'))
       alter table PULSESUBSCRIPTION add constraint PID598DT598 primary key ([UUID]);

    alter table PULSESUBSCRIPTION with nocheck
        add constraint FKPULSESUBSCRIPTIONID597
        foreign key ([MAPPING])
        references PULSE
        on delete no action;

    CREATE TRIGGER UFKPULSESUBSCRIPTIONID597 ON PULSE
        FOR DELETE
        AS
        BEGIN
            DELETE t
            FROM DELETED d
                INNER JOIN PULSESUBSCRIPTION t ON d.UUID = t.MAPPING
        END;

    alter table PULSESUBSCRIPTION with check check constraint FKPULSESUBSCRIPTIONID597;

    create index IDX_PULSESUBSCRIPTIONID597 on PULSESUBSCRIPTION ([MAPPING]);

    alter table PULSESUBSCRIPTION
        add constraint DT598UUID_DEFAULT DEFAULT newid() FOR [UUID];

    alter table PULSESUBSCRIPTION
        add constraint DT598UUID_NOT_NULL check([UUID] is not null);
