Commit 4e93c384 authored by celdem's avatar celdem

Add timestamp to software license policy

parent a1b5260e
# frozen_string_literal: true
class AddTimestampSoftwarelicensespolicy < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
add_timestamps_with_timezone(:software_license_policies, null: true)
end
def down
remove_timestamps(:software_license_policies)
end
end
......@@ -3824,6 +3824,8 @@ ActiveRecord::Schema.define(version: 2020_01_08_100603) do
t.integer "project_id", null: false
t.integer "software_license_id", null: false
t.integer "classification", default: 0, null: false
t.datetime_with_timezone "created_at"
t.datetime_with_timezone "updated_at"
t.index ["project_id", "software_license_id"], name: "index_software_license_policies_unique_per_project", unique: true
t.index ["software_license_id"], name: "index_software_license_policies_on_software_license_id"
end
......
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'migrate', '20200107172020_add_timestamp_softwarelicensespolicy.rb')
describe AddTimestampSoftwarelicensespolicy, :migration do
let(:software_licenses_policy) { table(:software_license_policies) }
let(:projects) { table(:projects) }
let(:licenses) { table(:software_licenses) }
before do
projects.create!(name: 'gitlab', path: 'gitlab-org/gitlab-ce', namespace_id: 1)
licenses.create!(name: 'MIT')
software_licenses_policy.create!(project_id: projects.first.id, software_license_id: licenses.first.id)
end
it 'creates timestamps' do
migrate!
expect(software_licenses_policy.first.created_at).to be_nil
expect(software_licenses_policy.first.updated_at).to be_nil
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment