Skip to content

Add pages_deployment model

Vladimir Shushlin requested to merge 235729-add-pages_deployment-model into master

What does this MR do?

Adds a PagesDeployment model and pages_deployments table. This model will be used to store zip archive containing gitlab pages web-site.

Now it's not attached to anything, but we plan to copy artifacts archives to pages deployments and also zip existing pages directories on disk and create PagesDeployments with them.

Build reference is optional, because we want pages deployments to last even if pipeline is removed.

Migrations output

up:

./bin/rails db:migrate        
== 20200911120132 CreatePagesDeployments: migrating ===========================
-- create_table(:pages_deployments, {:if_not_exists=>true})
   -> 0.0360s
-- transaction_open?()
   -> 0.0000s
-- execute("ALTER TABLE pages_deployments\nADD CONSTRAINT check_f0fe8032dd\nCHECK ( char_length(file) <= 255 )\nNOT VALID;\n")
   -> 0.0011s
-- execute("ALTER TABLE pages_deployments VALIDATE CONSTRAINT check_f0fe8032dd;")
   -> 0.0019s
== 20200911120132 CreatePagesDeployments: migrated (0.1298s) ==================

== 20200911121027 AddPagesDeploymentProjectForeignKey: migrating ==============
-- add_foreign_key(:pages_deployments, :projects, {:column=>:project_id, :on_delete=>:cascade})
   -> 0.0123s
== 20200911121027 AddPagesDeploymentProjectForeignKey: migrated (0.0163s) =====

== 20200911121048 AddPagesDeploymentCiBuildForeignKey: migrating ==============
-- add_foreign_key(:pages_deployments, :ci_builds, {:column=>:ci_build_id, :on_delete=>:nullify})
   -> 0.0068s
== 20200911121048 AddPagesDeploymentCiBuildForeignKey: migrated (0.0108s) =====

down:

./bin/rails db:rollback STEP=3
== 20200911121048 AddPagesDeploymentCiBuildForeignKey: reverting ==============
-- remove_foreign_key(:pages_deployments, {:column=>:ci_build_id})
   -> 0.0233s
== 20200911121048 AddPagesDeploymentCiBuildForeignKey: reverted (0.0344s) =====

== 20200911121027 AddPagesDeploymentProjectForeignKey: reverting ==============
-- remove_foreign_key(:pages_deployments, {:column=>:project_id})
   -> 0.0056s
== 20200911121027 AddPagesDeploymentProjectForeignKey: reverted (0.0078s) =====

== 20200911120132 CreatePagesDeployments: reverting ===========================
-- drop_table(:pages_deployments)
   -> 0.0072s
== 20200911120132 CreatePagesDeployments: reverted (0.0074s) ==================

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #235729 (closed)

Edited by Mayra Cabrera

Merge request reports