Improve code style in migration [SCI-4552]

This commit is contained in:
Oleksii Kriuchykhin 2020-04-29 10:42:00 +02:00
parent e6ad5047e0
commit 307a5d7e1b
2 changed files with 8 additions and 5 deletions

View file

@ -2,10 +2,13 @@
class AddRepositorySnapshots < ActiveRecord::Migration[6.0]
def up
add_column :repositories, :parent_id, :bigint, null: true
add_column :repositories, :status, :integer, null: true
change_table :repositories, bulk: true do |t|
t.string :type
t.bigint :parent_id, null: true
t.integer :status, null: true
end
add_reference :repositories, :my_module
add_column :repositories, :type, :string
execute "UPDATE \"repositories\" SET \"type\" = 'Repository'"
execute "UPDATE \"activities\" SET \"subject_type\" = 'RepositoryBase' WHERE \"subject_type\" = 'Repository'"

View file

@ -1100,10 +1100,10 @@ CREATE TABLE public.repositories (
updated_at timestamp without time zone,
discarded_at timestamp without time zone,
permission_level integer DEFAULT 0 NOT NULL,
type character varying,
parent_id bigint,
status integer,
my_module_id bigint,
type character varying
my_module_id bigint
);