5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-03 11:36:08 +00:00
panel/db/migrate/20220802153308_indexed_posts_by_uuid_and_site_id.rb

20 lines
597 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
# No podemos compartir el uuid entre indexed_posts y posts porque
# podemos tener sitios duplicados. Al menos hasta que los sitios de
# testeo estén integrados en el panel vamos a tener que generar otros
# UUID.
class IndexedPostsByUuidAndSiteId < ActiveRecord::Migration[6.1]
def up
add_column :indexed_posts, :post_id, :uuid, index: true
IndexedPost.transaction do
ActiveRecord::Base.connection.execute('update indexed_posts set post_id = id where post_id is null')
end
end
def down
remove_column :indexed_posts, :post_id
end
end