cartodb-4.42/db/migrate/20151006120423_remove_shared_entities_numeric_pk.rb
2024-04-06 05:25:13 +00:00

26 lines
717 B
Ruby

Sequel.migration do
up do
SequelRails.connection.run(%{
ALTER TABLE shared_entities DROP CONSTRAINT shared_entities_pkey;
})
SequelRails.connection.run(%{
ALTER TABLE shared_entities ADD PRIMARY KEY (recipient_id, entity_id);
})
SequelRails.connection.run(%{
ALTER TABLE shared_entities DROP COLUMN id;
})
end
down do
SequelRails.connection.run(%{
ALTER TABLE shared_entities DROP CONSTRAINT shared_entities_pkey;
})
SequelRails.connection.run(%{
ALTER TABLE shared_entities ADD COLUMN id serial NOT NULL;
})
SequelRails.connection.run(%{
ALTER TABLE shared_entities ADD PRIMARY KEY (id);
})
end
end