CREATE TABLE tx_msevent_domain_model_housebackend
(
    test varchar(255) NOT NULL DEFAULT ''
);

CREATE TABLE tx_msevent_domain_model_house
(
    name                          varchar(255) NOT NULL DEFAULT '',
    address                       varchar(255) NOT NULL DEFAULT '',
    email                         varchar(255) NOT NULL DEFAULT '',
    email_school                  varchar(255) NOT NULL DEFAULT '',
    phone                         varchar(255) NOT NULL DEFAULT '',
    phone_school                  varchar(255) NOT NULL DEFAULT '',
    fax                           varchar(255) NOT NULL DEFAULT '',
    description_top               text         NULL DEFAULT '',
    house_entrance_fees           text         NULL DEFAULT '',
    description_bottom            text         NULL DEFAULT '',
    colorbar                      varchar(255) NOT NULL DEFAULT '',
    twitter                       varchar(255) NOT NULL DEFAULT '',
    facebook                      varchar(255) NOT NULL DEFAULT '',
    wordpress                     varchar(255) NOT NULL DEFAULT '',
    instagram                     varchar(255) NOT NULL DEFAULT '',
    youtube                       varchar(255) NOT NULL DEFAULT '',
    linkedin                      varchar(255) NOT NULL DEFAULT '',
    foursquare                    varchar(255) NOT NULL DEFAULT '',
    house_category                varchar(255) NOT NULL DEFAULT '',
    googleplus                    varchar(255) NOT NULL DEFAULT '',
    image_title                   int(11) unsigned      DEFAULT '0' NOT NULL,
    house_is_visitable            int(11) unsigned      DEFAULT '0' NOT NULL,
    museums_switcher_teaser_image int(11) unsigned      DEFAULT '0' NOT NULL,
    longitude varchar(255) DEFAULT '' NOT NULL,
    latitude varchar(255) DEFAULT '' NOT NULL,
    date_text                     text         NULL DEFAULT '',
    date_text_en                  text         NULL DEFAULT '',
    place_link                    int(11) unsigned      DEFAULT '0' NOT NULL,
    date_link                     int(11) unsigned      DEFAULT '0' NOT NULL,
    date_link_normal              int(11) unsigned      DEFAULT '0' NOT NULL,
    date_link_closed              int(11) unsigned      DEFAULT '0' NOT NULL,
    date_link_time                int(11) unsigned      DEFAULT '0' NOT NULL,
    date_text_school               text NULL DEFAULT '',
    house_link varchar(255) DEFAULT '' NOT NULL,
    city varchar(255) DEFAULT '' NOT NULL,
    zip varchar(80) DEFAULT '' NOT NULL,
    flickr varchar(255) DEFAULT '' NOT NULL,
    joindate int(11) unsigned DEFAULT '0' NOT NULL,
    crm_id              varchar(255)        DEFAULT ''  NOT NULL

    /*plz varchar(255) NOT NULL DEFAULT '',
    ort varchar(255) NOT NULL DEFAULT '',*/
/*    houseentery varchar(255) NOT NULL DEFAULT '' */
);

#
# Table structure for table 'tx_msevent_domain_model_place'
#
CREATE TABLE tx_msevent_domain_model_place
(
    uid              int(11)                         NOT NULL auto_increment,
    pid              int(11)             DEFAULT '0' NOT NULL,

    name             varchar(255)        DEFAULT ''  NOT NULL,
    street           varchar(255)        DEFAULT ''  NOT NULL,
    zip              varchar(255)        DEFAULT ''  NOT NULL,
    city             varchar(255)        DEFAULT ''  NOT NULL,
    telephone        varchar(255)        DEFAULT ''  NOT NULL,
    email            varchar(255)        DEFAULT ''  NOT NULL,
    house_link       int(11) unsigned    DEFAULT '0' NOT NULL,
    event_link       int(11) unsigned    DEFAULT '0' NOT NULL,
    extra            text                            NOT NULL,

    tstamp           int(11) unsigned    DEFAULT '0' NOT NULL,
    crdate           int(11) unsigned    DEFAULT '0' NOT NULL,
    cruser_id        int(11) unsigned    DEFAULT '0' NOT NULL,
    deleted          tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden           tinyint(4) unsigned DEFAULT '0' NOT NULL,
    starttime        int(11) unsigned    DEFAULT '0' NOT NULL,
    endtime          int(11) unsigned    DEFAULT '0' NOT NULL,

    t3ver_oid        int(11)             DEFAULT '0' NOT NULL,
    t3ver_id         int(11)             DEFAULT '0' NOT NULL,
    t3ver_wsid       int(11)             DEFAULT '0' NOT NULL,
    t3ver_label      varchar(255)        DEFAULT ''  NOT NULL,
    t3ver_state      tinyint(4)          DEFAULT '0' NOT NULL,
    t3ver_stage      int(11)             DEFAULT '0' NOT NULL,
    t3ver_count      int(11)             DEFAULT '0' NOT NULL,
    t3ver_tstamp     int(11)             DEFAULT '0' NOT NULL,
    t3ver_move_id    int(11)             DEFAULT '0' NOT NULL,

    t3_origuid       int(11)             DEFAULT '0' NOT NULL,
    sys_language_uid int(11)             DEFAULT '0' NOT NULL,
    l10n_parent      int(11)             DEFAULT '0' NOT NULL,
    l10n_diffsource  mediumblob,
    # APPSync Extended Fields
    room_id          varchar(255)        DEFAULT ''  NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid, t3ver_wsid),
    KEY language (l10n_parent, sys_language_uid)

);

CREATE TABLE pages
(
    house         int(11) unsigned    DEFAULT '0',
    schoolevents  tinyint(4) unsigned DEFAULT '0',
    is_house_root int(11) unsigned    DEFAULT '0',
    sub_footer_storage int(11) unsigned    DEFAULT '0'
);



#
# Table structure for table 'tx_msevent_event_house_mm'
#
CREATE TABLE tx_msevent_event_house_mm
(
    uid_local       int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign     int(11) unsigned DEFAULT '0' NOT NULL,
    sorting         int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
    type int(11) unsigned DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);


#
# Table structure for table 'tx_msevent_place_house_mm'
#
CREATE TABLE tx_msevent_place_house_mm
(
    uid_local       int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign     int(11) unsigned DEFAULT '0' NOT NULL,
    sorting         int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);

CREATE TABLE tx_msevent_domain_model_specialdate
(
    uid                 int(11)                         NOT NULL auto_increment,
    pid                 int(11)             DEFAULT '0' NOT NULL,
    days                varchar(255)        DEFAULT ''  NOT NULL,
    months              varchar(255)        DEFAULT ''  NOT NULL,
    from_date           int(11)             DEFAULT '0' NOT NULL,
    to_date             varchar(255)        DEFAULT '0' NOT NULL,
    from_time           int(11)             DEFAULT '0' NOT NULL,
    to_time             int(11)             DEFAULT '0' NOT NULL,
    type                int(11)             DEFAULT '0' NOT NULL,
    additional_text     text                            NOT NULL,
    additional_text_en  text                            NOT NULL,
    owner               int(11)             DEFAULT '0' NOT NULL,
    link                int(11)             DEFAULT '0' NOT NULL,
    last_opening_modify int(15)             DEFAULT '0' NOT NULL,

    tstamp              int(11) unsigned    DEFAULT '0' NOT NULL,
    crdate              int(11) unsigned    DEFAULT '0' NOT NULL,
    cruser_id           int(11) unsigned    DEFAULT '0' NOT NULL,
    deleted             tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden              tinyint(4) unsigned DEFAULT '0' NOT NULL,
    starttime           int(11) unsigned    DEFAULT '0' NOT NULL,
    endtime             int(11) unsigned    DEFAULT '0' NOT NULL,

    t3ver_oid           int(11)             DEFAULT '0' NOT NULL,
    t3ver_id            int(11)             DEFAULT '0' NOT NULL,
    t3ver_wsid          int(11)             DEFAULT '0' NOT NULL,
    t3ver_label         varchar(255)        DEFAULT ''  NOT NULL,
    t3ver_state         tinyint(4)          DEFAULT '0' NOT NULL,
    t3ver_stage         int(11)             DEFAULT '0' NOT NULL,
    t3ver_count         int(11)             DEFAULT '0' NOT NULL,
    t3ver_tstamp        int(11)             DEFAULT '0' NOT NULL,
    t3ver_move_id       int(11)             DEFAULT '0' NOT NULL,

    t3_origuid          int(11)             DEFAULT '0' NOT NULL,
    sys_language_uid    int(11)             DEFAULT '0' NOT NULL,
    l10n_parent         int(11)             DEFAULT '0' NOT NULL,
    l10n_diffsource     mediumblob,

# APPSync Extended Fields
    crm_house_id        varchar(255)        DEFAULT ''  NOT NULL,
    crm_id              varchar(255)        DEFAULT ''  NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid, t3ver_wsid),
    KEY language (l10n_parent, sys_language_uid)

);


CREATE TABLE tx_msevent_house_specialdate_mm
(
    uid             int(11)                      NOT NULL auto_increment,
    uid_local       int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign     int(11) unsigned DEFAULT '0' NOT NULL,
    sorting         int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
    type            int(11)          DEFAULT '0' NOT NULL,

    PRIMARY KEY (uid),
    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);

CREATE TABLE tx_msevent_domain_model_event
(

    uid                            int(11)                         NOT NULL auto_increment,
    pid                            int(11)             DEFAULT '0' NOT NULL,

    title                          varchar(255)        DEFAULT ''  NOT NULL,
    subtitle                       varchar(255)        DEFAULT ''  NOT NULL,
    description                    text                            NOT NULL,
    from_date                      int(11)             DEFAULT '0' NOT NULL,
    to_date                        int(11)             DEFAULT '0' NOT NULL,
    show_date                      int(11)             DEFAULT '0' NOT NULL,
    from_time                      int(11)             DEFAULT '0' NOT NULL,
    to_time                        int(11)             DEFAULT '0' NOT NULL,
    image                          int(11) unsigned DEFAULT '0' NOT NULL,
    kurator                        varchar(255)        DEFAULT ''  NOT NULL,
    co_kurator                     varchar(255)        DEFAULT ''  NOT NULL,
    presented_by                   varchar(255)        DEFAULT '',
    show_presented_by              int(11)             DEFAULT '0' NOT NULL,
    lecturer                       varchar(255)        DEFAULT ''  NOT NULL,
    date_booked_up                 varchar(255)        DEFAULT ''  NOT NULL,
    audioguide                     text                DEFAULT '',
    app                            int(11)             DEFAULT '0' NOT NULL,
    event_priority_sameday         int(11)             DEFAULT '0' NOT NULL,
    catalog                        text                DEFAULT '',
    catalog_link                   varchar(255)        DEFAULT ''  NOT NULL,
    glossar                        varchar(255)        DEFAULT ''  NOT NULL,
    downloads                      text                DEFAULT '',
    rightboximage                  text                DEFAULT '',
    rightboximagelocation          int(11)             DEFAULT '0' NOT NULL,
    type                           varchar(255)        DEFAULT ''  NOT NULL,
    format                         varchar(255)        DEFAULT ''  NOT NULL,
    target                         varchar(255)        DEFAULT ''  NOT NULL,
    event_link                     int(11) unsigned    DEFAULT '0',
    presse_event_link              varchar(255)        DEFAULT '',
    house_link                     int(11) unsigned    DEFAULT '0' NOT NULL,
    content                        int(11) unsigned    DEFAULT '0' NOT NULL,
    venue                          varchar(255)        DEFAULT ''  NOT NULL,
    opening                        varchar(255)        DEFAULT ''  NOT NULL,
    cost                           varchar(255)        DEFAULT ''  NOT NULL,
    registration                   text                DEFAULT '',
    cooperation                    text                DEFAULT '',
    exhibition_design              text                DEFAULT '',
    information                    text                DEFAULT '',
    press_appointment              text                DEFAULT '',
    press_location                 text                DEFAULT '',
    register_external              text                NULL DEFAULT '',
    date_link                      int(11) unsigned    DEFAULT '0' NOT NULL,
    date_link_closed               int(11) unsigned    DEFAULT '0' NOT NULL,
    shownextdates                  tinyint(11)         DEFAULT '0' NOT NULL,
    place_link                     int(11) unsigned    DEFAULT '0' NOT NULL,
    language                       varchar(255)        DEFAULT ''  NOT NULL,
    page_link                      varchar(255)        DEFAULT ''  NOT NULL,
    page_redirect                  varchar(255)        DEFAULT ''  NOT NULL,
    slug                           varchar(255)        DEFAULT ''  NOT NULL,
    keywords                       varchar(255)        DEFAULT ''  NOT NULL,
    rightbox                       text                DEFAULT '',
    showheader                     tinyint(11)         DEFAULT '0' NOT NULL,
    coords                         varchar(500)        DEFAULT ''  NOT NULL,
    right_button_link              varchar(255)        DEFAULT ''  NOT NULL,
    right_button_text              varchar(100)        DEFAULT ''  NOT NULL,
    rightbox_label                 varchar(255)        DEFAULT ''  NOT NULL,
    ignore_opening                 int(11)             DEFAULT '0' NOT NULL,
    canonical                      varchar(255)        DEFAULT ''  NOT NULL,
    showOnIntranet                 tinyint(4)          DEFAULT '0' NOT NULL,

    date_title                     varchar(255)        DEFAULT ''  NOT NULL,
    date_additional_text           varchar(255)        DEFAULT ''  NOT NULL,

    record_type                    int(11)             DEFAULT '0' NOT NULL,
    type_school                    varchar(255)        DEFAULT ''  NOT NULL,
    format_school                  varchar(255)        DEFAULT ''  NOT NULL,
    target_school                  varchar(255)        DEFAULT ''  NOT NULL,
    school_grades                  varchar(255)        DEFAULT ''  NOT NULL,
    school_grades_text             varchar(255)        DEFAULT ''  NOT NULL,
    date_event_link                varchar(255)        DEFAULT '0'  NOT NULL,
    date_event_link_hook_field     varchar(255)        DEFAULT ''  NOT NULL,
    method                         text                DEFAULT '',
    duration                       varchar(255)        DEFAULT ''  NOT NULL,
    cost_school                    varchar(16)         DEFAULT '0' NOT NULL,
    cost_school_override           varchar(255)        DEFAULT ''  NOT NULL,
    cost_kindergarten              varchar(16)         DEFAULT '0' NOT NULL,
    cost_kindergarten_override     varchar(255)        DEFAULT ''  NOT NULL,
    school_registration            varchar(16)         DEFAULT '0' NOT NULL,
    school_registration_text       text                DEFAULT '',
    tip_from_date                  int(11)             DEFAULT '0'  NULL,
    tip_to_date                    int(11)             DEFAULT '0'  NULL,
    date_from_closed               int(11)             DEFAULT '0' NOT NULL,
    date_to_closed                 int(11)             DEFAULT '0' NOT NULL,
    date_closed_active             tinyint(4)          DEFAULT '0' NOT NULL,

    tstamp                         int(11) unsigned    DEFAULT '0' NOT NULL,
    crdate                         int(11) unsigned    DEFAULT '0' NOT NULL,
    cruser_id                      int(11) unsigned    DEFAULT '0' NOT NULL,
    deleted                        tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden                         tinyint(4) unsigned DEFAULT '0' NOT NULL,
    starttime                      int(11) unsigned    DEFAULT '0' NOT NULL,
    endtime                        int(11) unsigned    DEFAULT '0' NOT NULL,
    sorting                        int(11) unsigned DEFAULT '0' NOT NULL,

    t3ver_oid                      int(11)             DEFAULT '0' NOT NULL,
    t3ver_id                       int(11)             DEFAULT '0' NOT NULL,
    t3ver_wsid                     int(11)             DEFAULT '0' NOT NULL,
    t3ver_label                    varchar(255)        DEFAULT ''  NOT NULL,
    t3ver_state                    tinyint(4)          DEFAULT '0' NOT NULL,
    t3ver_stage                    int(11)             DEFAULT '0' NOT NULL,
    t3ver_count                    int(11)             DEFAULT '0' NOT NULL,
    t3ver_tstamp                   int(11)             DEFAULT '0' NOT NULL,
    t3ver_move_id                  int(11)             DEFAULT '0' NOT NULL,

    t3_origuid                     int(11)             DEFAULT '0' NOT NULL,
    sys_language_uid               int(11)             DEFAULT '0' NOT NULL,
    l10n_parent                    int(11)             DEFAULT '0' NOT NULL,
    l10n_diffsource                mediumblob,

    allow_access_api_jahresticket  int(11)             DEFAULT '0' NOT NULL,
    allow_access_api_club_joanneum int(11)             DEFAULT '0' NOT NULL,

    old_typo3_event_uid                    int(11)             DEFAULT '0' NOT NULL,

# APPSync Extended Fields
    crm_id                         varchar(255)        DEFAULT ''  NOT NULL,
    crm_text_long                  text                DEFAULT '',
    crm_text_teaser                text                DEFAULT '',
    crm_webtext_long               text                DEFAULT '',
    crm_webtext_teaser             text                DEFAULT '',
    digital_program                int(11)             DEFAULT '0' NOT NULL,
    is_serie                       int(11)             DEFAULT '0' NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid, t3ver_wsid),
    KEY language (l10n_parent, sys_language_uid)

);

#
# Table structure for table 'tx_msevent_event_event_mm'
#
CREATE TABLE tx_msevent_event_event_mm
(
    uid_local       int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign     int(11) unsigned DEFAULT '0' NOT NULL,
    sorting         int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,

    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);



CREATE TABLE tt_content
(
    event INT(11) unsigned DEFAULT '0' NOT NULL,
    KEY ms_event (event, sorting)
);


#
# Table structure for table 'tx_msevent_event_specialdate_mm'
#
CREATE TABLE tx_msevent_event_specialdate_mm
(
    uid             int(11)                      NOT NULL auto_increment,
    uid_local       int(11) unsigned DEFAULT '0' NOT NULL,
    uid_foreign     int(11) unsigned DEFAULT '0' NOT NULL,
    sorting         int(11) unsigned DEFAULT '0' NOT NULL,
    sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
    type            int(11)          DEFAULT '0' NOT NULL,

    PRIMARY KEY (uid),
    KEY uid_local (uid_local),
    KEY uid_foreign (uid_foreign)
);

#
# Table structure for table 'tx_msevent_house_opening'
#
CREATE TABLE sys_file_reference
(
    tx_msevent_houselogo_height VARCHAR(250) DEFAULT '' NOT NULL
);

CREATE TABLE tx_msevent_house_opening
(
    uid       int(11)                      NOT NULL auto_increment,
    pid       int(11)          DEFAULT '0' NOT NULL,
    tstamp    int(15) unsigned DEFAULT '0' NOT NULL,

    model     VARCHAR(250)     DEFAULT ''  NOT NULL,

    from_time int(11) unsigned DEFAULT '0' NOT NULL,
    to_time   int(11) unsigned DEFAULT '0' NOT NULL,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY cache_tag (model)

);

CREATE TABLE event_dates
(
    id        int auto_increment
        primary key,
    event_id  int          not null,
    from_date datetime     null,
    to_date   datetime     null,
    crm_id    varchar(255) null,
    tstamp    int          null
);


CREATE TABLE tx_msevent_domain_model_format (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,

    from_date int(11) DEFAULT '0' NOT NULL,
    to_date int(11) DEFAULT '0' NOT NULL,
    name varchar(255) DEFAULT '' NOT NULL,
    name_en varchar(255) DEFAULT '' NOT NULL,

    tstamp int(11) unsigned DEFAULT '0' NOT NULL,
    crdate int(11) unsigned DEFAULT '0' NOT NULL,
    cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
    deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
    hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
    starttime int(11) unsigned DEFAULT '0' NOT NULL,
    endtime int(11) unsigned DEFAULT '0' NOT NULL,

    t3ver_oid int(11) DEFAULT '0' NOT NULL,
    t3ver_id int(11) DEFAULT '0' NOT NULL,
    t3ver_wsid int(11) DEFAULT '0' NOT NULL,
    t3ver_label varchar(255) DEFAULT '' NOT NULL,
    t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
    t3ver_stage int(11) DEFAULT '0' NOT NULL,
    t3ver_count int(11) DEFAULT '0' NOT NULL,
    t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
    t3ver_move_id int(11) DEFAULT '0' NOT NULL,

    t3_origuid int(11) DEFAULT '0' NOT NULL,
    sys_language_uid int(11) DEFAULT '0' NOT NULL,
    l10n_parent int(11) DEFAULT '0' NOT NULL,
    l10n_diffsource mediumblob,

    PRIMARY KEY (uid),
    KEY parent (pid),
    KEY t3ver_oid (t3ver_oid,t3ver_wsid),
    KEY language (l10n_parent,sys_language_uid)

);

/*
 type = house,event,
 status = success,failed,
 msg = terminal output,
 */
CREATE TABLE sync_log_crm
(
    uid          int auto_increment  primary key,
    type         varchar(255)        null,
    status       varchar(255)        null,
    msg          text                NULL DEFAULT '',
    success      int                 null,
    create_date datetime             null,
);



