BEGIN TRANSACTION;

CREATE TABLE alembic_version (
    version_num VARCHAR(32) NOT NULL
);

GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO

CREATE TABLE musiconhold (
    name VARCHAR(80) NOT NULL, 
    mode VARCHAR(10) NULL, 
    directory VARCHAR(255) NULL, 
    application VARCHAR(255) NULL, 
    digit VARCHAR(1) NULL, 
    sort VARCHAR(10) NULL, 
    format VARCHAR(10) NULL, 
    stamp DATETIME NULL, 
    PRIMARY KEY (name), 
    CONSTRAINT moh_mode_values CHECK (mode IN ('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3'))
);

GO

INSERT INTO alembic_version (version_num) VALUES ('4da0c5f79a9c');

GO


GO


GO


GO


GO

CREATE TABLE ps_aors (
    id VARCHAR(40) NOT NULL, 
    contact VARCHAR(40) NULL, 
    default_expiration INTEGER NULL, 
    mailboxes VARCHAR(80) NULL, 
    max_contacts INTEGER NULL, 
    minimum_expiration INTEGER NULL, 
    remove_existing VARCHAR(3) NULL, 
    qualify_frequency INTEGER NULL, 
    authenticate_qualify VARCHAR(3) NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (remove_existing IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (authenticate_qualify IN ('yes', 'no'))
);

GO

CREATE INDEX ps_aors_id ON ps_aors (id);

GO

CREATE TABLE ps_contacts (
    id VARCHAR(40) NOT NULL, 
    uri VARCHAR(40) NULL, 
    expiration_time VARCHAR(40) NULL, 
    qualify_frequency INTEGER NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_contacts_id ON ps_contacts (id);

GO

CREATE TABLE ps_domain_aliases (
    id VARCHAR(40) NOT NULL, 
    domain VARCHAR(80) NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_domain_aliases_id ON ps_domain_aliases (id);

GO

CREATE TABLE ps_endpoint_id_ips (
    id VARCHAR(40) NOT NULL, 
    endpoint VARCHAR(40) NULL, 
    match VARCHAR(80) NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_endpoint_id_ips_id ON ps_endpoint_id_ips (id);

GO

UPDATE alembic_version SET version_num='43956d550a44' WHERE alembic_version.version_num = '4da0c5f79a9c';

GO

-- Running upgrade 43956d550a44 -> 581a4264e537

CREATE TABLE extensions (
    id BIGINT NOT NULL IDENTITY(1,1), 
    context VARCHAR(40) NOT NULL, 
    exten VARCHAR(40) NOT NULL, 
    priority INTEGER NOT NULL, 
    app VARCHAR(40) NOT NULL, 
    appdata VARCHAR(256) NOT NULL, 
    PRIMARY KEY (id), 
    UNIQUE (context, exten, priority), 
    UNIQUE (id)
);

GO

UPDATE alembic_version SET version_num='581a4264e537' WHERE alembic_version.version_num = '43956d550a44';

GO

-- Running upgrade 581a4264e537 -> 2fc7930b41b3

CREATE TABLE ps_systems (
    id VARCHAR(40) NOT NULL, 
    timer_t1 INTEGER NULL, 
    timer_b INTEGER NULL, 
    compact_headers VARCHAR(3) NULL, 
    threadpool_initial_size INTEGER NULL, 
    threadpool_auto_increment INTEGER NULL, 
    threadpool_idle_timeout INTEGER NULL, 
    threadpool_max_size INTEGER NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (compact_headers IN ('yes', 'no'))
);

GO

CREATE INDEX ps_systems_id ON ps_systems (id);

GO

CREATE TABLE ps_globals (
    id VARCHAR(40) NOT NULL, 
    max_forwards INTEGER NULL, 
    user_agent VARCHAR(40) NULL, 
    default_outbound_endpoint VARCHAR(40) NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_globals_id ON ps_globals (id);

GO


GO


GO

CREATE TABLE ps_registrations (
    id VARCHAR(40) NOT NULL, 
    auth_rejection_permanent VARCHAR(3) NULL, 
    client_uri VARCHAR(40) NULL, 
    contact_user VARCHAR(40) NULL, 
    expiration INTEGER NULL, 
    max_retries INTEGER NULL, 
    outbound_auth VARCHAR(40) NULL, 
    outbound_proxy VARCHAR(40) NULL, 
    retry_interval INTEGER NULL, 
    forbidden_retry_interval INTEGER NULL, 
    server_uri VARCHAR(40) NULL, 
    transport VARCHAR(40) NULL, 
    support_path VARCHAR(3) NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (auth_rejection_permanent IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (support_path IN ('yes', 'no'))
);

GO

CREATE INDEX ps_registrations_id ON ps_registrations (id);

GO


GO


GO


GO


GO


GO

ALTER TABLE ps_contacts ADD outbound_proxy VARCHAR(40) NULL;

GO

ALTER TABLE ps_contacts ADD path TEXT NULL;

GO

ALTER TABLE ps_aors ADD maximum_expiration INTEGER NULL;

GO

ALTER TABLE ps_aors ADD outbound_proxy VARCHAR(40) NULL;

GO

ALTER TABLE ps_aors ADD support_path VARCHAR(3) NULL;

GO

ALTER TABLE ps_aors ADD CONSTRAINT yesno_values CHECK (support_path IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='2fc7930b41b3' WHERE alembic_version.version_num = '581a4264e537';

GO

-- Running upgrade 2fc7930b41b3 -> 21e526ad3040

ALTER TABLE ps_globals ADD debug VARCHAR(40) NULL;

GO

UPDATE alembic_version SET version_num='21e526ad3040' WHERE alembic_version.version_num = '2fc7930b41b3';

GO

-- Running upgrade 21e526ad3040 -> 28887f25a46f

CREATE TABLE queues (
    name VARCHAR(128) NOT NULL, 
    musiconhold VARCHAR(128) NULL, 
    announce VARCHAR(128) NULL, 
    context VARCHAR(128) NULL, 
    timeout INTEGER NULL, 
    ringinuse VARCHAR(3) NULL, 
    setinterfacevar VARCHAR(3) NULL, 
    setqueuevar VARCHAR(3) NULL, 
    setqueueentryvar VARCHAR(3) NULL, 
    monitor_format VARCHAR(8) NULL, 
    membermacro VARCHAR(512) NULL, 
    membergosub VARCHAR(512) NULL, 
    queue_youarenext VARCHAR(128) NULL, 
    queue_thereare VARCHAR(128) NULL, 
    queue_callswaiting VARCHAR(128) NULL, 
    queue_quantity1 VARCHAR(128) NULL, 
    queue_quantity2 VARCHAR(128) NULL, 
    queue_holdtime VARCHAR(128) NULL, 
    queue_minutes VARCHAR(128) NULL, 
    queue_minute VARCHAR(128) NULL, 
    queue_seconds VARCHAR(128) NULL, 
    queue_thankyou VARCHAR(128) NULL, 
    queue_callerannounce VARCHAR(128) NULL, 
    queue_reporthold VARCHAR(128) NULL, 
    announce_frequency INTEGER NULL, 
    announce_to_first_user VARCHAR(3) NULL, 
    min_announce_frequency INTEGER NULL, 
    announce_round_seconds INTEGER NULL, 
    announce_holdtime VARCHAR(128) NULL, 
    announce_position VARCHAR(128) NULL, 
    announce_position_limit INTEGER NULL, 
    periodic_announce VARCHAR(50) NULL, 
    periodic_announce_frequency INTEGER NULL, 
    relative_periodic_announce VARCHAR(3) NULL, 
    random_periodic_announce VARCHAR(3) NULL, 
    retry INTEGER NULL, 
    wrapuptime INTEGER NULL, 
    penaltymemberslimit INTEGER NULL, 
    autofill VARCHAR(3) NULL, 
    monitor_type VARCHAR(128) NULL, 
    autopause VARCHAR(3) NULL, 
    autopausedelay INTEGER NULL, 
    autopausebusy VARCHAR(3) NULL, 
    autopauseunavail VARCHAR(3) NULL, 
    maxlen INTEGER NULL, 
    servicelevel INTEGER NULL, 
    strategy VARCHAR(11) NULL, 
    joinempty VARCHAR(128) NULL, 
    leavewhenempty VARCHAR(128) NULL, 
    reportholdtime VARCHAR(3) NULL, 
    memberdelay INTEGER NULL, 
    weight INTEGER NULL, 
    timeoutrestart VARCHAR(3) NULL, 
    defaultrule VARCHAR(128) NULL, 
    timeoutpriority VARCHAR(128) NULL, 
    PRIMARY KEY (name), 
    CONSTRAINT yesno_values CHECK (ringinuse IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (setinterfacevar IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (setqueuevar IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (setqueueentryvar IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (announce_to_first_user IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (relative_periodic_announce IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (random_periodic_announce IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (autofill IN ('yes', 'no')), 
    CONSTRAINT queue_autopause_values CHECK (autopause IN ('yes', 'no', 'all')), 
    CONSTRAINT yesno_values CHECK (autopausebusy IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (autopauseunavail IN ('yes', 'no')), 
    CONSTRAINT queue_strategy_values CHECK (strategy IN ('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered')), 
    CONSTRAINT yesno_values CHECK (reportholdtime IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (timeoutrestart IN ('yes', 'no'))
);

GO

CREATE TABLE queue_members (
    queue_name VARCHAR(80) NOT NULL, 
    interface VARCHAR(80) NOT NULL, 
    uniqueid VARCHAR(80) NOT NULL, 
    membername VARCHAR(80) NULL, 
    state_interface VARCHAR(80) NULL, 
    penalty INTEGER NULL, 
    paused INTEGER NULL, 
    PRIMARY KEY (queue_name, interface)
);

GO

UPDATE alembic_version SET version_num='28887f25a46f' WHERE alembic_version.version_num = '21e526ad3040';

GO


GO


GO


GO


GO


GO


GO


GO


GO


GO


GO

UPDATE alembic_version SET version_num='4c573e7135bd' WHERE alembic_version.version_num = '28887f25a46f';

GO


GO

ALTER TABLE ps_contacts ADD user_agent VARCHAR(40) NULL;

GO

UPDATE alembic_version SET version_num='3855ee4e5f85' WHERE alembic_version.version_num = '4c573e7135bd';

GO

-- Running upgrade 3855ee4e5f85 -> e96a0b8071c

ALTER TABLE ps_globals ALTER COLUMN user_agent VARCHAR(255);

GO

ALTER TABLE ps_contacts ALTER COLUMN id VARCHAR(255);

GO

ALTER TABLE ps_contacts ALTER COLUMN uri VARCHAR(255);

GO

ALTER TABLE ps_contacts ALTER COLUMN user_agent VARCHAR(255);

GO

ALTER TABLE ps_registrations ALTER COLUMN client_uri VARCHAR(255);

GO

ALTER TABLE ps_registrations ALTER COLUMN server_uri VARCHAR(255);

GO

UPDATE alembic_version SET version_num='e96a0b8071c' WHERE alembic_version.version_num = '3855ee4e5f85';

GO

-- Running upgrade e96a0b8071c -> c6d929b23a8

CREATE TABLE ps_subscription_persistence (
    id VARCHAR(40) NOT NULL, 
    packet VARCHAR(2048) NULL, 
    src_name VARCHAR(128) NULL, 
    src_port INTEGER NULL, 
    transport_key VARCHAR(64) NULL, 
    local_name VARCHAR(128) NULL, 
    local_port INTEGER NULL, 
    cseq INTEGER NULL, 
    tag VARCHAR(128) NULL, 
    endpoint VARCHAR(40) NULL, 
    expires INTEGER NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_subscription_persistence_id ON ps_subscription_persistence (id);

GO

UPDATE alembic_version SET version_num='c6d929b23a8' WHERE alembic_version.version_num = 'e96a0b8071c';

GO


GO


GO


GO


GO

UPDATE alembic_version SET version_num='51f8cb66540e' WHERE alembic_version.version_num = 'c6d929b23a8';

GO


GO

UPDATE alembic_version SET version_num='1d50859ed02e' WHERE alembic_version.version_num = '51f8cb66540e';

GO


GO

UPDATE alembic_version SET version_num='1758e8bbf6b' WHERE alembic_version.version_num = '1d50859ed02e';

GO

-- Running upgrade 1758e8bbf6b -> 5139253c0423

ALTER TABLE queue_members DROP COLUMN uniqueid;

GO

ALTER TABLE queue_members ADD uniqueid INTEGER NOT NULL;

GO

ALTER TABLE queue_members ADD UNIQUE (uniqueid);

GO

UPDATE alembic_version SET version_num='5139253c0423' WHERE alembic_version.version_num = '1758e8bbf6b';

GO

-- Running upgrade 5139253c0423 -> d39508cb8d8

CREATE TABLE queue_rules (
    rule_name VARCHAR(80) NOT NULL, 
    time VARCHAR(32) NOT NULL, 
    min_penalty VARCHAR(32) NOT NULL, 
    max_penalty VARCHAR(32) NOT NULL
);

GO

UPDATE alembic_version SET version_num='d39508cb8d8' WHERE alembic_version.version_num = '5139253c0423';

GO


GO


GO


GO


GO


GO

UPDATE alembic_version SET version_num='5950038a6ead' WHERE alembic_version.version_num = 'd39508cb8d8';

GO


GO


GO


GO

UPDATE alembic_version SET version_num='10aedae86a32' WHERE alembic_version.version_num = '5950038a6ead';

GO


GO


GO

UPDATE alembic_version SET version_num='eb88a14f2a' WHERE alembic_version.version_num = '10aedae86a32';

GO


GO


GO

UPDATE alembic_version SET version_num='371a3bf4143e' WHERE alembic_version.version_num = 'eb88a14f2a';

GO

-- Running upgrade 371a3bf4143e -> 45e3f47c6c44

ALTER TABLE ps_globals ADD endpoint_identifier_order VARCHAR(40) NULL;

GO

UPDATE alembic_version SET version_num='45e3f47c6c44' WHERE alembic_version.version_num = '371a3bf4143e';

GO


GO


GO

UPDATE alembic_version SET version_num='23530d604b96' WHERE alembic_version.version_num = '45e3f47c6c44';

GO


GO


GO


GO

UPDATE alembic_version SET version_num='31cd4f4891ec' WHERE alembic_version.version_num = '23530d604b96';

GO

-- Running upgrade 31cd4f4891ec -> 461d7d691209

ALTER TABLE ps_aors ADD qualify_timeout INTEGER NULL;

GO

ALTER TABLE ps_contacts ADD qualify_timeout INTEGER NULL;

GO

UPDATE alembic_version SET version_num='461d7d691209' WHERE alembic_version.version_num = '31cd4f4891ec';

GO

-- Running upgrade 461d7d691209 -> a541e0b5e89

ALTER TABLE ps_globals ADD max_initial_qualify_time INTEGER NULL;

GO

UPDATE alembic_version SET version_num='a541e0b5e89' WHERE alembic_version.version_num = '461d7d691209';

GO


GO


GO

UPDATE alembic_version SET version_num='28b8e71e541f' WHERE alembic_version.version_num = 'a541e0b5e89';

GO


GO

UPDATE alembic_version SET version_num='498357a710ae' WHERE alembic_version.version_num = '28b8e71e541f';

GO


GO


GO

UPDATE alembic_version SET version_num='26f10cadc157' WHERE alembic_version.version_num = '498357a710ae';

GO

-- Running upgrade 26f10cadc157 -> 154177371065

ALTER TABLE ps_globals ADD default_from_user VARCHAR(80) NULL;

GO

UPDATE alembic_version SET version_num='154177371065' WHERE alembic_version.version_num = '26f10cadc157';

GO

-- Running upgrade 154177371065 -> 28ce1e718f05

ALTER TABLE ps_registrations ADD fatal_retry_interval INTEGER NULL;

GO

UPDATE alembic_version SET version_num='28ce1e718f05' WHERE alembic_version.version_num = '154177371065';

GO

-- Running upgrade 28ce1e718f05 -> 189a235b3fd7

ALTER TABLE ps_globals ADD keep_alive_interval INTEGER NULL;

GO

UPDATE alembic_version SET version_num='189a235b3fd7' WHERE alembic_version.version_num = '28ce1e718f05';

GO

-- Running upgrade 189a235b3fd7 -> 2d078ec071b7

ALTER TABLE ps_aors ALTER COLUMN contact VARCHAR(255);

GO

UPDATE alembic_version SET version_num='2d078ec071b7' WHERE alembic_version.version_num = '189a235b3fd7';

GO


GO


GO

UPDATE alembic_version SET version_num='26d7f3bf0fa5' WHERE alembic_version.version_num = '2d078ec071b7';

GO

-- Running upgrade 26d7f3bf0fa5 -> 136885b81223

ALTER TABLE ps_globals ADD regcontext VARCHAR(80) NULL;

GO

UPDATE alembic_version SET version_num='136885b81223' WHERE alembic_version.version_num = '26d7f3bf0fa5';

GO

-- Running upgrade 136885b81223 -> 423f34ad36e2

ALTER TABLE ps_aors ALTER COLUMN qualify_timeout FLOAT;

GO

ALTER TABLE ps_contacts ALTER COLUMN qualify_timeout FLOAT;

GO

UPDATE alembic_version SET version_num='423f34ad36e2' WHERE alembic_version.version_num = '136885b81223';

GO

-- Running upgrade 423f34ad36e2 -> dbc44d5a908

ALTER TABLE ps_systems ADD disable_tcp_switch VARCHAR(3) NULL;

GO

ALTER TABLE ps_systems ADD CONSTRAINT yesno_values CHECK (disable_tcp_switch IN ('yes', 'no'));

GO

ALTER TABLE ps_registrations ADD line VARCHAR(3) NULL;

GO

ALTER TABLE ps_registrations ADD CONSTRAINT yesno_values CHECK (line IN ('yes', 'no'));

GO

ALTER TABLE ps_registrations ADD endpoint VARCHAR(40) NULL;

GO

UPDATE alembic_version SET version_num='dbc44d5a908' WHERE alembic_version.version_num = '423f34ad36e2';

GO


GO


GO

UPDATE alembic_version SET version_num='3bcc0b5bc2c9' WHERE alembic_version.version_num = 'dbc44d5a908';

GO

-- Running upgrade 3bcc0b5bc2c9 -> 5813202e92be

ALTER TABLE ps_globals ADD contact_expiration_check_interval INTEGER NULL;

GO

UPDATE alembic_version SET version_num='5813202e92be' WHERE alembic_version.version_num = '3bcc0b5bc2c9';

GO

-- Running upgrade 5813202e92be -> 1c688d9a003c

ALTER TABLE ps_globals ADD default_voicemail_extension VARCHAR(40) NULL;

GO

ALTER TABLE ps_aors ADD voicemail_extension VARCHAR(40) NULL;

GO


GO


GO

UPDATE alembic_version SET version_num='1c688d9a003c' WHERE alembic_version.version_num = '5813202e92be';

GO

-- Running upgrade 1c688d9a003c -> 8d478ab86e29

ALTER TABLE ps_globals ADD disable_multi_domain VARCHAR(3) NULL;

GO

ALTER TABLE ps_globals ADD CONSTRAINT yesno_values CHECK (disable_multi_domain IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='8d478ab86e29' WHERE alembic_version.version_num = '1c688d9a003c';

GO

-- Running upgrade 8d478ab86e29 -> 65eb22eb195

ALTER TABLE ps_globals ADD unidentified_request_count INTEGER NULL;

GO

ALTER TABLE ps_globals ADD unidentified_request_period INTEGER NULL;

GO

ALTER TABLE ps_globals ADD unidentified_request_prune_interval INTEGER NULL;

GO

ALTER TABLE ps_globals ADD default_realm VARCHAR(40) NULL;

GO

UPDATE alembic_version SET version_num='65eb22eb195' WHERE alembic_version.version_num = '8d478ab86e29';

GO

-- Running upgrade 65eb22eb195 -> 81b01a191a46

ALTER TABLE ps_contacts ADD reg_server VARCHAR(20) NULL;

GO

ALTER TABLE ps_contacts ADD CONSTRAINT ps_contacts_uq UNIQUE (id, reg_server);

GO

UPDATE alembic_version SET version_num='81b01a191a46' WHERE alembic_version.version_num = '65eb22eb195';

GO

-- Running upgrade 81b01a191a46 -> 6be31516058d

ALTER TABLE ps_contacts ADD authenticate_qualify VARCHAR(3) NULL;

GO

ALTER TABLE ps_contacts ADD CONSTRAINT yesno_values CHECK (authenticate_qualify IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='6be31516058d' WHERE alembic_version.version_num = '81b01a191a46';

GO


GO


GO


GO


GO


GO


GO

UPDATE alembic_version SET version_num='bca7113d796f' WHERE alembic_version.version_num = '6be31516058d';

GO

-- Running upgrade bca7113d796f -> a845e4d8ade8

ALTER TABLE ps_contacts ADD via_addr VARCHAR(40) NULL;

GO

ALTER TABLE ps_contacts ADD via_port INTEGER NULL;

GO

ALTER TABLE ps_contacts ADD call_id VARCHAR(255) NULL;

GO

UPDATE alembic_version SET version_num='a845e4d8ade8' WHERE alembic_version.version_num = 'bca7113d796f';

GO

-- Running upgrade a845e4d8ade8 -> ef7efc2d3964

ALTER TABLE ps_contacts ADD endpoint VARCHAR(40) NULL;

GO

ALTER TABLE ps_contacts ALTER COLUMN expiration_time BIGINT;

GO

CREATE INDEX ps_contacts_qualifyfreq_exp ON ps_contacts (qualify_frequency, expiration_time);

GO

CREATE INDEX ps_aors_qualifyfreq_contact ON ps_aors (qualify_frequency, contact);

GO

UPDATE alembic_version SET version_num='ef7efc2d3964' WHERE alembic_version.version_num = 'a845e4d8ade8';

GO


GO

UPDATE alembic_version SET version_num='9deac0ae4717' WHERE alembic_version.version_num = 'ef7efc2d3964';

GO


GO

UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.version_num = '9deac0ae4717';

GO

-- Running upgrade 4a6c67fa9b7a -> c7a44a5a0851

ALTER TABLE ps_globals ADD mwi_tps_queue_high INTEGER NULL;

GO

ALTER TABLE ps_globals ADD mwi_tps_queue_low INTEGER NULL;

GO

ALTER TABLE ps_globals ADD mwi_disable_initial_unsolicited VARCHAR(3) NULL;

GO

ALTER TABLE ps_globals ADD CONSTRAINT yesno_values CHECK (mwi_disable_initial_unsolicited IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='c7a44a5a0851' WHERE alembic_version.version_num = '4a6c67fa9b7a';

GO


GO


GO


GO

UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = 'c7a44a5a0851';

GO


GO

UPDATE alembic_version SET version_num='4e2493ef32e6' WHERE alembic_version.version_num = '3772f8f828da';

GO

-- Running upgrade 4e2493ef32e6 -> a6ef36f1309

ALTER TABLE ps_globals ADD ignore_uri_user_options VARCHAR(3) NULL;

GO

ALTER TABLE ps_globals ADD CONSTRAINT yesno_values CHECK (ignore_uri_user_options IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='a6ef36f1309' WHERE alembic_version.version_num = '4e2493ef32e6';

GO


GO


GO

UPDATE alembic_version SET version_num='4468b4a91372' WHERE alembic_version.version_num = 'a6ef36f1309';

GO

-- Running upgrade 4468b4a91372 -> 28ab27a7826d

ALTER TABLE ps_endpoint_id_ips ADD srv_lookups VARCHAR(3) NULL;

GO

ALTER TABLE ps_endpoint_id_ips ADD CONSTRAINT yesno_values CHECK (srv_lookups IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='28ab27a7826d' WHERE alembic_version.version_num = '4468b4a91372';

GO

-- Running upgrade 28ab27a7826d -> 465e70e8c337

ALTER TABLE ps_endpoint_id_ips ADD match_header VARCHAR(255) NULL;

GO

UPDATE alembic_version SET version_num='465e70e8c337' WHERE alembic_version.version_num = '28ab27a7826d';

GO


GO


GO

UPDATE alembic_version SET version_num='15db7b91a97a' WHERE alembic_version.version_num = '465e70e8c337';

GO


GO


GO

ALTER TABLE ps_subscription_persistence ADD contact_uri VARCHAR(256) NULL;

GO

UPDATE alembic_version SET version_num='f638dbe2eb23' WHERE alembic_version.version_num = '15db7b91a97a';

GO


GO


GO

UPDATE alembic_version SET version_num='8fce4c573e15' WHERE alembic_version.version_num = 'f638dbe2eb23';

GO

-- Running upgrade 8fce4c573e15 -> 2da192dbbc65

CREATE TABLE ps_outbound_publishes (
    id VARCHAR(40) NOT NULL, 
    expiration INTEGER NULL, 
    outbound_auth VARCHAR(40) NULL, 
    outbound_proxy VARCHAR(256) NULL, 
    server_uri VARCHAR(256) NULL, 
    from_uri VARCHAR(256) NULL, 
    to_uri VARCHAR(256) NULL, 
    event VARCHAR(40) NULL, 
    max_auth_attempts INTEGER NULL, 
    transport VARCHAR(40) NULL, 
    multi_user VARCHAR(3) NULL, 
    [@body] VARCHAR(40) NULL, 
    [@context] VARCHAR(256) NULL, 
    [@exten] VARCHAR(256) NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (multi_user IN ('yes', 'no'))
);

GO

CREATE INDEX ps_outbound_publishes_id ON ps_outbound_publishes (id);

GO

CREATE TABLE ps_inbound_publications (
    id VARCHAR(40) NOT NULL, 
    endpoint VARCHAR(40) NULL, 
    [event_asterisk-devicestate] VARCHAR(40) NULL, 
    [event_asterisk-mwi] VARCHAR(40) NULL, 
    UNIQUE (id)
);

GO

CREATE INDEX ps_inbound_publications_id ON ps_inbound_publications (id);

GO

CREATE TABLE ps_asterisk_publications (
    id VARCHAR(40) NOT NULL, 
    devicestate_publish VARCHAR(40) NULL, 
    mailboxstate_publish VARCHAR(40) NULL, 
    device_state VARCHAR(3) NULL, 
    device_state_filter VARCHAR(256) NULL, 
    mailbox_state VARCHAR(3) NULL, 
    mailbox_state_filter VARCHAR(256) NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (device_state IN ('yes', 'no')), 
    CONSTRAINT yesno_values CHECK (mailbox_state IN ('yes', 'no'))
);

GO

CREATE INDEX ps_asterisk_publications_id ON ps_asterisk_publications (id);

GO

UPDATE alembic_version SET version_num='2da192dbbc65' WHERE alembic_version.version_num = '8fce4c573e15';

GO

-- Running upgrade 2da192dbbc65 -> 1d0e332c32af

CREATE TABLE ps_resource_list (
    id VARCHAR(40) NOT NULL, 
    list_item VARCHAR(2048) NULL, 
    event VARCHAR(40) NULL, 
    full_state VARCHAR(3) NULL, 
    notification_batch_interval INTEGER NULL, 
    UNIQUE (id), 
    CONSTRAINT yesno_values CHECK (full_state IN ('yes', 'no'))
);

GO

CREATE INDEX ps_resource_list_id ON ps_resource_list (id);

GO

UPDATE alembic_version SET version_num='1d0e332c32af' WHERE alembic_version.version_num = '2da192dbbc65';

GO


GO


GO

UPDATE alembic_version SET version_num='86bb1efa278d' WHERE alembic_version.version_num = '1d0e332c32af';

GO


GO


GO

UPDATE alembic_version SET version_num='d7983954dd96' WHERE alembic_version.version_num = '86bb1efa278d';

GO


GO


GO


GO

UPDATE alembic_version SET version_num='164abbd708c' WHERE alembic_version.version_num = 'd7983954dd96';

GO

-- Running upgrade 164abbd708c -> f3d1c5d38b56

ALTER TABLE ps_contacts ADD prune_on_boot VARCHAR(3) NULL;

GO

ALTER TABLE ps_contacts ADD CONSTRAINT yesno_values CHECK (prune_on_boot IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='f3d1c5d38b56' WHERE alembic_version.version_num = '164abbd708c';

GO


GO


GO

UPDATE alembic_version SET version_num='b83645976fdd' WHERE alembic_version.version_num = 'f3d1c5d38b56';

GO


GO

UPDATE alembic_version SET version_num='a1698e8bb9c5' WHERE alembic_version.version_num = 'b83645976fdd';

GO


GO


GO


GO

UPDATE alembic_version SET version_num='20abce6d1e3c' WHERE alembic_version.version_num = 'a1698e8bb9c5';

GO


GO


GO

UPDATE alembic_version SET version_num='52798ad97bdf' WHERE alembic_version.version_num = '20abce6d1e3c';

GO

-- Running upgrade 52798ad97bdf -> d3e4284f8707

ALTER TABLE ps_subscription_persistence ADD prune_on_boot VARCHAR(3) NULL;

GO

ALTER TABLE ps_subscription_persistence ADD CONSTRAINT yesno_values CHECK (prune_on_boot IN ('yes', 'no'));

GO

UPDATE alembic_version SET version_num='d3e4284f8707' WHERE alembic_version.version_num = '52798ad97bdf';

GO

COMMIT;

GO

