source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
test/op_connect/client/items_test.rb
Ruby
mit
20
main
5,845
require "test_helper" describe OpConnect::Client::Items do let(:stubs) { Faraday::Adapter::Test::Stubs.new } let(:client) { OpConnect::Client.new(access_token: "fake", adapter: :test, stubs: stubs) } describe "list_items" do it "returns a list of items for a vault" do stubs.get("/v1/vaults/ftz4pm2xxwm...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
test/op_connect/client/files_test.rb
Ruby
mit
20
main
1,764
require "test_helper" describe OpConnect::Client::Files do let(:stubs) { Faraday::Adapter::Test::Stubs.new } let(:client) { OpConnect::Client.new(access_token: "fake", adapter: :test, stubs: stubs) } describe "list_files" do it "returns a list of files for an item" do stubs.get("/v1/vaults/ftz4pm2xxwm...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect.rb
Ruby
mit
20
main
1,451
# frozen_string_literal: true require "faraday" require "faraday_middleware" # Ruby toolkit for the 1Password Connect REST API. # module OpConnect autoload :Client, "op_connect/client" autoload :Configurable, "op_connect/configurable" autoload :Connection, "op_connect/connection" autoload :Default, "op_connec...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/vault.rb
Ruby
mit
20
main
495
module OpConnect class Vault attr_reader :id, :name, :attribute_version, :content_version, :items, :type, :created_at, :updated_at def initialize(options = {}) @id = options["id"] @name = options["name"] @attribute_version = options["attributeVersion"] @content_version = options["cont...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/connection.rb
Ruby
mit
20
main
2,786
module OpConnect # Network layer for API clients. # module Connection # Make an HTTP GET request. # # @param url [String] The path, relative to {#api_endpoint}. # @param params [Hash] Query parameters for the request. # @param headers [Hash] Header params for the request. # # @return [...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/api_request.rb
Ruby
mit
20
main
521
module OpConnect class APIRequest autoload :Actor, "op_connect/api_request/actor" autoload :Resource, "op_connect/api_request/resource" attr_reader :request_id, :timestamp, :action, :result, :actor, :resource def initialize(options = {}) @request_id = options["request_id"] @timestamp = o...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/default.rb
Ruby
mit
20
main
1,206
# frozen_string_literal: true require "op_connect/version" module OpConnect # Default configuration options for {Client} # module Default API_ENDPOINT = "http://localhost:8080/v1" USER_AGENT = "1Password Connect Ruby SDK #{OpConnect::VERSION}" class << self # Configuration options # ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/configurable.rb
Ruby
mit
20
main
850
module OpConnect module Configurable attr_accessor :access_token, :adapter, :stubs, :user_agent attr_writer :api_endpoint class << self def keys @keys ||= [ :access_token, :adapter, :api_endpoint, :stubs, :user_agent ] end ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/client.rb
Ruby
mit
20
main
2,190
module OpConnect # Client for the OpConnect API. # class Client autoload :Vaults, "op_connect/client/vaults" autoload :Items, "op_connect/client/items" autoload :Files, "op_connect/client/files" include OpConnect::Configurable include OpConnect::Connection include OpConnect::Client::Vault...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/server_health.rb
Ruby
mit
20
main
374
module OpConnect class ServerHealth autoload :Dependency, "op_connect/server_health/dependency" attr_reader :name, :version, :dependencies def initialize(options = {}) @name = options["name"] @version = options["version"] @dependencies = options["dependencies"]&.collect! { |dependency|...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/error.rb
Ruby
mit
20
main
1,537
module OpConnect class Error < StandardError class << self def from_response(response) status = response.status if (klass = case status when 400 then OpConnect::BadRequest when 401 then OpConnect::Unauthorized when 403 then OpConnect::Forbidden ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/object.rb
Ruby
mit
20
main
403
require "ostruct" module OpConnect class Object < SimpleDelegator def initialize(attributes) super to_ostruct(attributes) end private def to_ostruct(obj) if obj.is_a?(Hash) OpenStruct.new(obj.map { |key, value| [key, to_ostruct(value)] }.to_h) elsif obj.is_a?(Array) ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item.rb
Ruby
mit
20
main
1,257
module OpConnect class Item autoload :Field, "op_connect/item/field" autoload :File, "op_connect/item/file" autoload :GeneratorRecipe, "op_connect/item/generator_recipe" autoload :Section, "op_connect/item/section" autoload :URL, "op_connect/item/url" attr_reader :id, :title, :vault, :categor...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/client/vaults.rb
Ruby
mit
20
main
344
module OpConnect class Client module Vaults def list_vaults(**params) get("vaults", params: params).body.map { |vault| Vault.new(vault) } end alias_method :vaults, :list_vaults def get_vault(id:) Vault.new get("vaults/#{id}").body end alias_method :vault, :get_...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/client/files.rb
Ruby
mit
20
main
675
module OpConnect class Client module Files def list_files(vault_id:, item_id:, **params) get("vaults/#{vault_id}/items/#{item_id}/files", params: params).body.map { |file| Item::File.new(file) } end alias_method :files, :list_files def get_file(vault_id:, item_id:, id:, **params) ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/client/items.rb
Ruby
mit
20
main
1,558
module OpConnect class Client module Items # Get a list of items from a vault. # # @param vault_id [String] The vault UUID. # @param params [Hash] Query parameters. # @option params [String] :filter Optionally filter the item collection # based on item title using SCIM-sytle ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/api_request/actor.rb
Ruby
mit
20
main
340
module OpConnect class APIRequest class Actor attr_reader :id, :account, :jti, :user_agent, :ip def initialize(options = {}) @id = options["id"] @account = options["account"] @jti = options["jti"] @user_agent = options["user_agent"] @ip = options["ip"] en...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/api_request/resource.rb
Ruby
mit
20
main
343
module OpConnect class APIRequest class Resource attr_reader :type, :vault, :item, :item_version def initialize(options = {}) @type = options["type"] @vault = Object.new(options["vault"]) @item = Object.new(options["item"]) @item_version = options["item_version"] ...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/response/raise_error.rb
Ruby
mit
20
main
386
module OpConnect # Faraday response middleware # module Response # This class raises an OpConnect-flavored exception based on HTTP status # codes returned by the API. # class RaiseError < Faraday::Middleware def on_complete(response) if (error = OpConnect::Error.from_response(respons...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/server_health/dependency.rb
Ruby
mit
20
main
281
module OpConnect class ServerHealth class Dependency attr_reader :service, :status, :message def initialize(options = {}) @service = options["service"] @status = options["status"] @message = options["message"] end end end end
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item/generator_recipe.rb
Ruby
mit
20
main
305
module OpConnect class Item class GeneratorRecipe attr_reader :length, :character_sets def initialize(options = {}) @length = options["length"] if options & ["length"] @character_sets = options["characterSets"] if options & ["characterSets"] end end end end
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item/section.rb
Ruby
mit
20
main
204
module OpConnect class Item class Section attr_reader :id, :label def initialize(options = {}) @id = options["id"] @label = options["label"] end end end end
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item/field.rb
Ruby
mit
20
main
579
module OpConnect class Item class Field attr_reader :id, :purpose, :type, :value, :should_generate, :recipe, :section alias_method :generate?, :should_generate def initialize(options = {}) @id = options["id"] @purpose = options["purpose"] if options["purpose"] @type = o...
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item/url.rb
Ruby
mit
20
main
267
module OpConnect class Item class URL attr_reader :url, :is_primary alias_method :primary?, :is_primary def initialize(options = {}) @url = options["url"] @is_primary = options["primary"] || false end end end end
github
partydrone/connect-sdk-ruby
https://github.com/partydrone/connect-sdk-ruby
lib/op_connect/item/file.rb
Ruby
mit
20
main
408
module OpConnect class Item class File attr_reader :id, :name, :size, :content_path, :content, :section def initialize(options = {}) @id = options["id"] @name = options["name"] @size = options["size"] @content_path = options["content_path"] @content = options["...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
Rakefile
Ruby
mit
19
main
369
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative "config/application" Rails.application.load_tasks desc "Lint ruby files" task lint: :environment do sh "bundle exec rubocop --parallel app c...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
Gemfile
Ruby
mit
19
main
1,103
source "https://rubygems.org" gem "rails", "~> 8.0.0" # GOV.UK gems and forks gem "gds-api-adapters" gem "gds-sso" gem "govuk_app_config" gem "govuk_sidekiq" gem "plek" # Third party gems gem "active_model_serializers" gem "activerecord-import" gem "awesome_print" gem "bootsnap", require: false gem "csv" gem "google...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/schema.rb
Ruby
mit
19
main
33,423
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190213115655_update_aggregations_search_last_thirty_days_to_version_5.rb
Ruby
mit
19
main
217
class UpdateAggregationsSearchLastThirtyDaysToVersion5 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_thirty_days, version: 5, revert_to_version: 4, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170206153248_migrate_many_to_many_content_items_organisation.rb
Ruby
mit
19
main
379
class MigrateManyToManyContentItemsOrganisation < ActiveRecord::Migration[5.0] class ContentItem < ActiveRecord::Base belongs_to :organisation has_and_belongs_to_many :organisations end def change MigrateManyToManyContentItemsOrganisation::ContentItem.find_each do |content_item| content_item.or...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180301230712_add_quality_metrics_to_dimensions_items.rb
Ruby
mit
19
main
727
class AddQualityMetricsToDimensionsItems < ActiveRecord::Migration[5.1] def change add_column :dimensions_items, :readability_score, :integer add_column :dimensions_items, :contractions_count, :integer add_column :dimensions_items, :equality_count, :integer add_column :dimensions_items, :indefinite_ar...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190311164157_update_aggregations_search_last_six_months_to_version_7.rb
Ruby
mit
19
main
263
class UpdateAggregationsSearchLastSixMonthsToVersion7 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_six_months, version: 7, revert_to_version: 6, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190117125756_remove_avg_page_time.rb
Ruby
mit
19
main
237
class RemoveAvgPageTime < ActiveRecord::Migration[5.2] def change remove_column :aggregations_monthly_metrics, :avg_page_time remove_column :events_gas, :avg_page_time remove_column :facts_metrics, :avg_page_time end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180719133916_add_columns_to_dimensions_items.rb
Ruby
mit
19
main
546
class AddColumnsToDimensionsItems < ActiveRecord::Migration[5.1] def change add_column :dimensions_items, :publishing_app, :string add_column :dimensions_items, :rendering_app, :string add_column :dimensions_items, :analytics_identifier, :string add_column :dimensions_items, :phase, :string add_co...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190311163406_update_aggregations_search_last_twelve_months_to_version_7.rb
Ruby
mit
19
main
269
class UpdateAggregationsSearchLastTwelveMonthsToVersion7 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_twelve_months, version: 7, revert_to_version: 6, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190304151614_remove_default_satisfaction.rb
Ruby
mit
19
main
680
class RemoveDefaultSatisfaction < ActiveRecord::Migration[5.2] def up change_column :facts_metrics, :satisfaction, :float, null: true change_column_default :facts_metrics, :satisfaction, nil change_column :aggregations_monthly_metrics, :satisfaction, :float, null: true change_column_default :aggregat...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190214113305_add_index_views_using_warehouse_item_id.rb
Ruby
mit
19
main
3,824
class AddIndexViewsUsingWarehouseItemId < ActiveRecord::Migration[5.2] def change remove_index :aggregations_search_last_twelve_months, name: :search_last_twelve_months_gin_base_path_upviews remove_index :aggregations_search_last_twelve_months, name: :search_last_twelve_months_gin_base_path_organisation_id ...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170824143605_drop_join_table_groups_content_items.rb
Ruby
mit
19
main
302
class DropJoinTableGroupsContentItems < ActiveRecord::Migration[5.1] def change drop_join_table :groups, :content_items do |t| t.index [:content_item_id] t.index [:group_id] t.index %i[group_id content_item_id], name: "index_group_content_items", unique: true end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190207143213_add_index_facts_metrics_pviews.rb
Ruby
mit
19
main
201
class AddIndexFactsMetricsPviews < ActiveRecord::Migration[5.2] disable_ddl_transaction! def change add_index :facts_metrics, %i(dimensions_date_id pviews), algorithm: :concurrently end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190603083504_update_aggregations_search_last_three_months_to_version_9.rb
Ruby
mit
19
main
251
class UpdateAggregationsSearchLastThreeMonthsToVersion9 < ActiveRecord::Migration[5.2] def change update_view( :aggregations_search_last_three_months, version: 9, revert_to_version: 8, materialized: true, ) end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180205162236_remove_organisation_id_from_dimension_items_and_dimension_items_temps.rb
Ruby
mit
19
main
253
class RemoveOrganisationIdFromDimensionItemsAndDimensionItemsTemps < ActiveRecord::Migration[5.1] def change remove_column :dimensions_items, :organisation_id, :string remove_column :dimensions_items_temps, :organisation_id, :string end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180210231645_add_default_values_for_ga.rb
Ruby
mit
19
main
350
class AddDefaultValuesForGA < ActiveRecord::Migration[5.1] class Facts::Metric < ApplicationRecord end def up Facts::Metric.update_all(pageviews: 0, unique_pageviews: 0) change_column :facts_metrics, :pageviews, :integer, default: 0 change_column :facts_metrics, :unique_pageviews, :integer, default:...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180518133900_change_events_gas_page_views_to_default_to_zero.rb
Ruby
mit
19
main
388
class ChangeEventsGasPageViewsToDefaultToZero < ActiveRecord::Migration[5.1] def up change_column :events_gas, :pageviews, :integer, default: 0 change_column :events_gas, :unique_pageviews, :integer, default: 0 end def down change_column :events_gas, :pageviews, :integer, default: nil change_colu...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180509100804_remove_metadata_from_facts_editions.rb
Ruby
mit
19
main
384
class RemoveMetadataFromFactsEditions < ActiveRecord::Migration[5.1] def change remove_column :facts_editions, :raw_json, :json remove_column :facts_editions, :status, :string remove_column :facts_editions, :description, :string remove_column :facts_editions, :first_published_at, :datetime remove_...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180118133606_drop_taxonomy_todos_terms.rb
Ruby
mit
19
main
220
class DropTaxonomyTodosTerms < ActiveRecord::Migration[5.1] def change drop_table :taxonomy_todos_terms do |t| t.bigint "term_id", null: false t.bigint "taxonomy_todo_id", null: false end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190218121734_update_aggregations_search_last_months_to_version_4.rb
Ruby
mit
19
main
256
class UpdateAggregationsSearchLastMonthsToVersion4 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_months, version: 4, revert_to_version: 3, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190207143240_add_index_facts_metrics_searches.rb
Ruby
mit
19
main
205
class AddIndexFactsMetricsSearches < ActiveRecord::Migration[5.2] disable_ddl_transaction! def change add_index :facts_metrics, %i(dimensions_date_id searches), algorithm: :concurrently end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181002110036_rename_events_gas_columns.rb
Ruby
mit
19
main
512
class RenameEventsGasColumns < ActiveRecord::Migration[5.2] def change rename_column :events_gas, :number_of_internal_searches, :searches rename_column :events_gas, :pageviews, :pviews rename_column :events_gas, :unique_pageviews, :upviews rename_column :events_gas, :is_this_useful_yes, :useful_yes ...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181204142533_add_unique_index_to_last_month.rb
Ruby
mit
19
main
234
class AddUniqueIndexToLastMonth < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_months, %i(dimensions_edition_id warehouse_item_id), unique: true, name: "index_on_search_last_monthunique" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170824145959_drop_taxons_items_join_table.rb
Ruby
mit
19
main
273
class DropTaxonsItemsJoinTable < ActiveRecord::Migration[5.1] def change drop_join_table :content_items, :taxons do |t| t.index [:content_item_id] t.index %i[taxon_id content_item_id], name: "index_content_item_taxonomies", unique: true end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190213153521_clean_up_unused_indexes.rb
Ruby
mit
19
main
1,271
class CleanUpUnusedIndexes < ActiveRecord::Migration[5.2] def change remove_index :aggregations_search_last_thirty_days, name: :index_on_last_thirty_days_edition_id_upviews remove_index :aggregations_search_last_thirty_days, name: :index_on_search_last_thirty_days_unique remove_index :aggregations_searc...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181204144322_add_unique_index_to_last_six_months.rb
Ruby
mit
19
main
248
class AddUniqueIndexToLastSixMonths < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_six_months, %i(dimensions_edition_id warehouse_item_id), unique: true, name: "index_on_search_last_six_months_unique" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190213141801_update_aggregations_search_last_twelve_months_to_version_5.rb
Ruby
mit
19
main
221
class UpdateAggregationsSearchLastTwelveMonthsToVersion5 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_twelve_months, version: 5, revert_to_version: 4, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181211120306_update_aggregations_search_last_twelve_months_to_version_4.rb
Ruby
mit
19
main
269
class UpdateAggregationsSearchLastTwelveMonthsToVersion4 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_twelve_months, version: 4, revert_to_version: 3, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170706143916_create_join_table_for_todos_terms.rb
Ruby
mit
19
main
302
class CreateJoinTableForTodosTerms < ActiveRecord::Migration[5.1] def change create_join_table :terms, :taxonomy_todos do |t| t.index [:taxonomy_todo_id] t.index [:term_id] t.index %i[term_id taxonomy_todo_id], name: "index_terms_taxonomy_todos", unique: true end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180309144815_remove_links.rb
Ruby
mit
19
main
203
class RemoveLinks < ActiveRecord::Migration[5.1] def change drop_table :links do |t| t.string :source_content_id t.string :link_type t.string :target_content_id end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181121135744_add_full_text_index_title.rb
Ruby
mit
19
main
265
class AddFullTextIndexTitle < ActiveRecord::Migration[5.2] def up execute "create index dimensions_editions_title on dimensions_editions using gin(to_tsvector('english', title ))" end def down execute "drop index dimensions_editions_title" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190218124214_update_aggregations_search_last_twelve_months_to_version_6.rb
Ruby
mit
19
main
269
class UpdateAggregationsSearchLastTwelveMonthsToVersion6 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_twelve_months, version: 6, revert_to_version: 5, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20171229163406_create_facts_metrics.rb
Ruby
mit
19
main
419
class CreateFactsMetrics < ActiveRecord::Migration[5.1] def change create_table :facts_metrics do |t| t.date :dimensions_date_id, index: true t.references :dimensions_item, foreign_key: true t.references :dimensions_organisation, foreign_key: true t.timestamps end add_foreign_key...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181204145152_add_unique_index_to_last_twelve_months.rb
Ruby
mit
19
main
257
class AddUniqueIndexToLastTwelveMonths < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_twelve_months, %i(dimensions_edition_id warehouse_item_id), unique: true, name: "index_on_search_last_twelve_months_unique" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20171222101252_create_dimensions_organisations.rb
Ruby
mit
19
main
341
class CreateDimensionsOrganisations < ActiveRecord::Migration[5.1] def change create_table :dimensions_organisations do |t| t.string :title t.string :slug t.string :description t.string :link t.string :organisation_id t.string :state t.string :content_id t.timestam...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170607101811_create_subthemes.rb
Ruby
mit
19
main
257
class CreateSubthemes < ActiveRecord::Migration[5.1] def change create_table :subthemes do |t| t.belongs_to :theme t.string :name, null: false t.timestamps end add_index :subthemes, %i(theme_id name), unique: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181129125513_add_not_null_constraint_to_facts_metrics.rb
Ruby
mit
19
main
490
class AddNotNullConstraintToFactsMetrics < ActiveRecord::Migration[5.2] COLS = %i[pviews upviews feedex searches exits entrances bounce_rate avg_page_time bounces page_time].freeze def up COLS.each do |col| change_column_null :facts_metrics, col, false change_column_default :facts_metrics, col, 0 ...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180417102741_add_payload_version_to_dimensions_items.rb
Ruby
mit
19
main
277
class AddPayloadVersionToDimensionsItems < ActiveRecord::Migration[5.1] def change add_column :dimensions_items, :publishing_api_payload_version, :bigint, default: 0, null: false change_column_default :dimensions_items, :publishing_api_payload_version, nil end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181204143719_add_unique_index_to_last_three_months.rb
Ruby
mit
19
main
254
class AddUniqueIndexToLastThreeMonths < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_three_months, %i(dimensions_edition_id warehouse_item_id), unique: true, name: "index_on_search_last_three_months_unique" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181029112946_add_withdrawn_and_historical.rb
Ruby
mit
19
main
203
class AddWithdrawnAndHistorical < ActiveRecord::Migration[5.2] def change add_column :dimensions_editions, :withdrawn, :boolean add_column :dimensions_editions, :historical, :boolean end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181004113705_rename_dimensions_item_to_dimensions_editions.rb
Ruby
mit
19
main
572
class RenameDimensionsItemToDimensionsEditions < ActiveRecord::Migration[5.2] def change rename_table :dimensions_items, :dimensions_editions rename_index :dimensions_editions, "index_dimensions_items_primary_organisation_content_id", "index_dimensions_editions_organisation_id" rename_index :dimensions_e...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180926105207_add_constraints_to_satisfaction_score_columns.rb
Ruby
mit
19
main
367
class AddConstraintsToSatisfactionScoreColumns < ActiveRecord::Migration[5.2] def change change_column :facts_metrics, :satisfaction_score, :float, default: 0.0, null: false change_column :facts_metrics, :is_this_useful_yes, :integer, default: 0, null: false change_column :facts_metrics, :is_this_useful_n...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180305111459_drop_unused_indexes_to_reduce_space.rb
Ruby
mit
19
main
537
class DropUnusedIndexesToReduceSpace < ActiveRecord::Migration[5.1] def change # duplicated of [:dimensions_date_id, dimensions_item_id] remove_index :facts_metrics, :dimensions_date_id # This is no longer in used remove_index :content_items, :title # This index is no longer in use remove_in...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181101163401_add_withdrawn_constraints.rb
Ruby
mit
19
main
223
class AddWithdrawnConstraints < ActiveRecord::Migration[5.2] def up change_column_null :dimensions_editions, :withdrawn, false end def down change_column_null :dimensions_editions, :withdrawn, true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190218113118_update_aggregations_search_last_thirty_days_to_version_6.rb
Ruby
mit
19
main
265
class UpdateAggregationsSearchLastThirtyDaysToVersion6 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_thirty_days, version: 6, revert_to_version: 5, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180508161332_remove_quality_metrics_from_dimensions_items.rb
Ruby
mit
19
main
1,078
class RemoveQualityMetricsFromDimensionsItems < ActiveRecord::Migration[5.1] def change remove_column :dimensions_items, :number_of_pdfs, :integer remove_column :dimensions_items, :number_of_word_files, :integer remove_column :dimensions_items, :readability_score, :integer remove_column :dimensions_it...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190312141411_update_aggregations_search_last_months_to_version_6.rb
Ruby
mit
19
main
256
class UpdateAggregationsSearchLastMonthsToVersion6 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_months, version: 6, revert_to_version: 5, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180608124756_remove_default_values_in_editions.rb
Ruby
mit
19
main
277
class RemoveDefaultValuesInEditions < ActiveRecord::Migration[5.1] def change change_column_default :facts_editions, :string_length, nil change_column_default :facts_editions, :sentence_count, nil change_column_default :facts_editions, :word_count, nil end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190213155742_add_indexes_view_aggregations_search_last_month.rb
Ruby
mit
19
main
1,275
class AddIndexesViewAggregationsSearchLastMonth < ActiveRecord::Migration[5.2] def up execute "create index aggregations_search_last_month_gin_base_path on aggregations_search_last_months using gin(to_tsvector('english'::regconfig, replace((base_path)::text, '/'::text, ' '::text)))" execute "create index aggr...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181129111315_add_default_zeros_to_events_gas.rb
Ruby
mit
19
main
368
class AddDefaultZerosToEventsGas < ActiveRecord::Migration[5.2] COLS = %i[pviews upviews searches exits entrances bounces bounce_rate avg_page_time page_time].freeze def up COLS.each do |col| change_column_default(:events_gas, col, 0) end end def down COLS.each do |col| change_column_d...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170316110649_create_groups.rb
Ruby
mit
19
main
266
class CreateGroups < ActiveRecord::Migration[5.0] def change create_table :groups do |t| t.string :slug t.string :name t.string :group_type t.integer :parent_group_id, foreign_key: true, null: true t.timestamps end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170517133236_create_links.rb
Ruby
mit
19
main
340
class CreateLinks < ActiveRecord::Migration[5.0] def change create_table :links do |t| t.string :source_content_id t.string :link_type t.string :target_content_id t.timestamps end add_index :links, :source_content_id add_index :links, :target_content_id add_index :links, :...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180418135632_add_is_this_useful_columns_to_facts_metrics.rb
Ruby
mit
19
main
242
class AddIsThisUsefulColumnsToFactsMetrics < ActiveRecord::Migration[5.1] def change add_column :facts_metrics, :is_this_useful_yes, :integer, default: 0 add_column :facts_metrics, :is_this_useful_no, :integer, default: 0 end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170912052906_drop_inventory_rules.rb
Ruby
mit
19
main
260
class DropInventoryRules < ActiveRecord::Migration[5.1] def change drop_table :inventory_rules do |t| t.belongs_to :subtheme t.string :link_type, null: false t.string :target_content_id, null: false t.timestamps end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190213154809_add_indexes_view_aggregations_search_last_thirty_days.rb
Ruby
mit
19
main
1,380
class AddIndexesViewAggregationsSearchLastThirtyDays < ActiveRecord::Migration[5.2] def up execute "create index aggregations_search_last_thirty_days_gin_base_path on aggregations_search_last_thirty_days using gin(to_tsvector('english'::regconfig, replace((base_path)::text, '/'::text, ' '::text)))" execute "c...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190207143221_add_index_facts_metrics_upviews.rb
Ruby
mit
19
main
203
class AddIndexFactsMetricsUpviews < ActiveRecord::Migration[5.2] disable_ddl_transaction! def change add_index :facts_metrics, %i(dimensions_date_id upviews), algorithm: :concurrently end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181205154240_update_aggregations_search_last_thirty_days_to_version_3.rb
Ruby
mit
19
main
217
class UpdateAggregationsSearchLastThirtyDaysToVersion3 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_thirty_days, version: 3, revert_to_version: 2, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190311164701_update_aggregations_search_last_thirty_days_to_version_7.rb
Ruby
mit
19
main
265
class UpdateAggregationsSearchLastThirtyDaysToVersion7 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_thirty_days, version: 7, revert_to_version: 6, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190218122820_update_aggregations_search_last_three_months_to_version_6.rb
Ruby
mit
19
main
267
class UpdateAggregationsSearchLastThreeMonthsToVersion6 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_three_months, version: 6, revert_to_version: 5, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181106171806_add_index_to_last_three_months_aggregations.rb
Ruby
mit
19
main
241
class AddIndexToLastThreeMonthsAggregations < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_three_months, %w(dimensions_edition_id upviews), name: "index_on_last_three_months_edition_id_upviews" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181206120629_update_aggregations_search_last_twelve_months_to_version_3.rb
Ruby
mit
19
main
221
class UpdateAggregationsSearchLastTwelveMonthsToVersion3 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_twelve_months, version: 3, revert_to_version: 2, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180305112605_remove_table_dimensions_items_temp.rb
Ruby
mit
19
main
275
class RemoveTableDimensionsItemsTemp < ActiveRecord::Migration[5.1] def change drop_table :dimensions_items_temps do |t| t.string :content_id t.string :title t.string :link t.string :description t.string :organisation_id end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190603083515_update_aggregations_search_last_twelve_months_to_version_9.rb
Ruby
mit
19
main
253
class UpdateAggregationsSearchLastTwelveMonthsToVersion9 < ActiveRecord::Migration[5.2] def change update_view( :aggregations_search_last_twelve_months, version: 9, revert_to_version: 8, materialized: true, ) end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180514085910_add_additional_metrics_to_events_gas_and_facts_metrics.rb
Ruby
mit
19
main
617
class AddAdditionalMetricsToEventsGasAndFactsMetrics < ActiveRecord::Migration[5.1] def change add_column :events_gas, :exits, :integer, default: 0 add_column :events_gas, :entrances, :integer, default: 0 add_column :events_gas, :bounce_rate, :integer, default: 0 add_column :events_gas, :avg_time_on_p...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20170606105748_create_join_table_group_content_item.rb
Ruby
mit
19
main
304
class CreateJoinTableGroupContentItem < ActiveRecord::Migration[5.1] def change create_join_table :groups, :content_items do |t| t.index [:content_item_id] t.index [:group_id] t.index %i[group_id content_item_id], name: "index_group_content_items", unique: true end end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190218123800_update_aggregations_search_last_six_months_to_version_6.rb
Ruby
mit
19
main
263
class UpdateAggregationsSearchLastSixMonthsToVersion6 < ActiveRecord::Migration[5.2] def change update_view :aggregations_search_last_six_months, version: 6, revert_to_version: 5, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180425092626_create_facts_editions.rb
Ruby
mit
19
main
1,272
class CreateFactsEditions < ActiveRecord::Migration[5.1] def change create_table :facts_editions do |t| t.date :dimensions_date_id, index: true t.bigint :dimensions_item_id t.integer :number_of_pdfs t.integer :number_of_word_files t.integer :readability_score t.integer :contra...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181105160339_add_index_to_last_thirty_days.rb
Ruby
mit
19
main
226
class AddIndexToLastThirtyDays < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_thirty_days, %w(dimensions_edition_id upviews), name: "index_on_last_thirty_days_edition_id_upviews" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181105152020_create_aggregations_search_last_thirty_days.rb
Ruby
mit
19
main
216
class CreateAggregationsSearchLastThirtyDays < ActiveRecord::Migration[5.2] def change Aggregations::MaterializedView.prepare create_view :aggregations_search_last_thirty_days, materialized: true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20180131112209_drop_dimensions_organisations.rb
Ruby
mit
19
main
355
class DropDimensionsOrganisations < ActiveRecord::Migration[5.1] def change drop_table :dimensions_organisations do |t| t.string "title" t.string "slug" t.string "description" t.string "link" t.string "organisation_id" t.string "state" t.string "content_id" t.timest...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20190118145538_update_acronym_for_organisations.rb
Ruby
mit
19
main
340
class UpdateAcronymForOrganisations < ActiveRecord::Migration[5.2] def up Dimensions::Edition.where(document_type: "organisation").find_each do |edition| event = edition.publishing_api_event acronym = event.payload.dig("details", "acronym") edition.update(acronym: acronym.blank? ? nil : acronym...
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181204140034_add_unique_index_to_last_thirty_days.rb
Ruby
mit
19
main
251
class AddUniqueIndexToLastThirtyDays < ActiveRecord::Migration[5.2] def change add_index :aggregations_search_last_thirty_days, %i(dimensions_edition_id warehouse_item_id), unique: true, name: "index_on_search_last_thirty_days_unique" end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181101163411_add_historical_constraints.rb
Ruby
mit
19
main
226
class AddHistoricalConstraints < ActiveRecord::Migration[5.2] def up change_column_null :dimensions_editions, :historical, false end def down change_column_null :dimensions_editions, :historical, true end end
github
alphagov/content-data-api
https://github.com/alphagov/content-data-api
db/migrate/20181101123329_add_foreign_key_to_monthly_aggregation.rb
Ruby
mit
19
main
217
class AddForeignKeyToMonthlyAggregation < ActiveRecord::Migration[5.2] def change add_foreign_key :aggregations_monthly_metrics, :dimensions_months, foreign_key: :dimensions_month_id, primary_key: :id end end