mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
Improve code style in migration [SCI-4552]
This commit is contained in:
parent
e6ad5047e0
commit
307a5d7e1b
2 changed files with 8 additions and 5 deletions
|
@ -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'"
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue