LIKE staging.mailing_address_stage INCLUDING DEFAULTS
);
-ALTER TABLE staging.billing_address_stage ADD CONSTRAINT PRIMARY KEY (row_id);
+ALTER TABLE staging.billing_address_stage ADD PRIMARY KEY (row_id);
CREATE TABLE staging.statcat_stage (
row_id BIGSERIAL PRIMARY KEY,
CREATE OR REPLACE VIEW money.billable_xact_summary AS
SELECT * FROM money.materialized_billable_xact_summary;
-ALTER TABLE money.materialized_billable_xact_summary ADD CONSTRAINT PRIMARY KEY (id);
+ALTER TABLE money.materialized_billable_xact_summary ADD PRIMARY KEY (id);
CREATE INDEX money_mat_summary_usr_idx ON money.materialized_billable_xact_summary (usr);
CREATE INDEX money_mat_summary_xact_start_idx ON money.materialized_billable_xact_summary (xact_start);
INSERT INTO config.upgrade_log (version) VALUES ('0356'); -- miker
-ALTER TABLE acq.edi_account DROP CONSTRAINT acq_edi_account_id_unique;
-ALTER TABLE acq.edi_account ADD CONSTRAINT PRIMARY KEY (id);
+ALTER TABLE acq.edi_account ADD PRIMARY KEY (id);
+ALTER TABLE acq.edi_account DROP CONSTRAINT acq_edi_account_id_unique CASCADE;
+
+-- Now rebuild the constraints dropped via cascade.
+ALTER TABLE acq.provider ADD CONSTRAINT provider_edi_default_fkey FOREIGN KEY (edi_default) REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE acq.edi_message ADD CONSTRAINT edi_message_account_fkey FOREIGN KEY (account ) REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED;
DROP INDEX money.money_mat_summary_id_idx;
-ALTER TABLE money.materialized_billable_xact_summary ADD CONSTRAINT PRIMARY KEY (id);
+ALTER TABLE money.materialized_billable_xact_summary ADD PRIMARY KEY (id);
-ALTER TABLE staging.billing_address_stage ADD CONSTRAINT PRIMARY KEY (row_id);
+ALTER TABLE staging.billing_address_stage ADD PRIMARY KEY (row_id);
COMMIT;