Sha256: 2f9b6c824df7b1d041abdf129cdf960c60f2e7ff38a8d31f1ce6dd32c462ff7d
Contents?: true
Size: 902 Bytes
Versions: 6
Compression:
Stored size: 902 Bytes
Contents
# frozen_string_literal: true module Dynamoid # @private module Tasks module Database module_function # Create any new tables for the models. Existing tables are not # modified. def create_tables results = { created: [], existing: [] } # We can't quite rely on Dynamoid.included_models alone, we need to select only viable models Dynamoid.included_models.reject { |m| m.base_class.try(:name).blank? }.uniq(&:table_name).each do |model| if Dynamoid.adapter.list_tables.include? model.table_name results[:existing] << model.table_name else model.create_table(sync: true) results[:created] << model.table_name end end results end # Is the DynamoDB reachable? def ping Dynamoid.adapter.list_tables true end end end end
Version data entries
6 entries across 6 versions & 1 rubygems