debian-mirror-gitlab/db/migrate/20230313181536_create_packages_npm_metadata_caches.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
792 B
Ruby
Raw Normal View History

2023-06-20 00:43:36 +05:30
# frozen_string_literal: true
class CreatePackagesNpmMetadataCaches < Gitlab::Database::Migration[2.1]
enable_lock_retries!
INDEX_NAME = 'index_npm_metadata_caches_on_package_name_project_id_unique'
def up
create_table :packages_npm_metadata_caches do |t|
t.timestamps_with_timezone
t.datetime_with_timezone :last_downloaded_at
t.bigint :project_id, index: true
t.integer :file_store, default: 1
t.integer :size, null: false
t.text :file, null: false, limit: 255
t.text :package_name, null: false # rubocop:disable Migration/AddLimitToTextColumns
t.index %i[package_name project_id], name: INDEX_NAME, unique: true, where: 'project_id IS NOT NULL'
end
end
def down
drop_table :packages_npm_metadata_caches
end
end