Skip to content

Create snippet_repository_storage_moves table

Vijay Hawoldar requested to merge vij-add-storage-move-table into master

What does this MR do?

As part of the effort to allow the moving of a snippet's repository storage (&3393 (closed)) we need to have a new table for tracking those moves.

This MR adds that table so that it can later be used (#218992 (closed)).

The migration (20201022144501_create_snippet_repository_storage_move.rb) creates the table, with a foreign key / index on snippet_id.

Migrate Up

bin/rails db:migrate
== 20201022144501 CreateSnippetRepositoryStorageMove: migrating ===============
-- table_exists?(:snippet_repository_storage_moves)
   -> 0.0005s
-- create_table(:snippet_repository_storage_moves)
   -> 0.0096s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE snippet_repository_storage_moves\nADD CONSTRAINT snippet_repository_storage_moves_source_storage_name\nCHECK ( char_length(source_storage_name) <= 255 )\nNOT VALID;\n")
   -> 0.0003s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- execute("ALTER TABLE snippet_repository_storage_moves VALIDATE CONSTRAINT snippet_repository_storage_moves_source_storage_name;")
   -> 0.0004s
-- execute("RESET ALL")
   -> 0.0001s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE snippet_repository_storage_moves\nADD CONSTRAINT snippet_repository_storage_moves_destination_storage_name\nCHECK ( char_length(destination_storage_name) <= 255 )\nNOT VALID;\n")
   -> 0.0003s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE snippet_repository_storage_moves VALIDATE CONSTRAINT snippet_repository_storage_moves_destination_storage_name;")
   -> 0.0004s
== 20201022144501 CreateSnippetRepositoryStorageMove: migrated (0.0220s) ======

Migrate Down

bin/rails db:rollback STEP=1
== 20201022144501 CreateSnippetRepositoryStorageMove: reverting ===============
-- drop_table(:snippet_repository_storage_moves)
   -> 0.0038s
== 20201022144501 CreateSnippetRepositoryStorageMove: reverted (0.0088s) ======

Refs #218984 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by Alper Akgun

Merge request reports