This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductAttribute < ActiveRecord::Base | |
include DiscriminableModel | |
uses_type_column :data_type do |data_type| | |
"#{data_type.to_s.camelize}ProductAttribute".safe_constantize | |
end | |
... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "{SYSTEM_ID}", | |
"parent_id": "{PARENT_SYSTEM_ID}", | |
"product_type": [ "leaf" ], | |
"updated_at": "2016-04-07T12:52:03.059Z", | |
"indexed_at": "2016-04-07T13:29:54.262+00:00", | |
"created_at": "2016-04-07T13:29:54.262+00:00", | |
"list_membership": [ | |
"{SYSTEM_ID}" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER migrate_products AFTER UPDATE OF migrated ON products FOR EACH ROW WHEN (OLD.migrated IS NULL AND NEW.migrated IS true) EXECUTE PROCEDURE populate_referenced_entities(); | |
CREATE OR REPLACE FUNCTION batch_set_migrated() RETURNS INTEGER LANGUAGE plpgsql AS $$ | |
DECLARE batched_count INTEGER = 1; | |
BEGIN | |
WITH unmigrated_products AS ( | |
SELECT id | |
FROM products | |
WHERE migrated IS NULL | |
LIMIT 50 |
OlderNewer