Skip to content

Add `state` column to catalog_resources table

Leaminn Ma requested to merge add-state-to-catalog-resources into master

What does this MR do and why?

Migration to add state column to the catalog_resources table.

The state column is an enum of two values: draft: 0 and published: 1. The default value is draft. This column allows us to determine whether or not the resource should be displayed in the Catalog.

Resolves #415289 (closed)

Migrations

Up

main: == [advisory_lock_connection] object_id: 223660, pg_backend_pid: 59831
main: == 20230630170515 AddStateToCatalogResources: migrating =======================
main: -- add_column(:catalog_resources, :state, :smallint, {:null=>false, :limit=>1, :default=>0})
main:    -> 0.0037s
main: == 20230630170515 AddStateToCatalogResources: migrated (0.0078s) ==============

main: == [advisory_lock_connection] object_id: 223660, pg_backend_pid: 59831
ci: == [advisory_lock_connection] object_id: 223920, pg_backend_pid: 59833
ci: == 20230630170515 AddStateToCatalogResources: migrating =======================
ci: -- add_column(:catalog_resources, :state, :smallint, {:null=>false, :limit=>1, :default=>0})
ci:    -> 0.0033s
ci: == 20230630170515 AddStateToCatalogResources: migrated (0.0113s) ==============

ci: == [advisory_lock_connection] object_id: 223920, pg_backend_pid: 59833

Down

main: == [advisory_lock_connection] object_id: 223300, pg_backend_pid: 69092
main: == 20230630170515 AddStateToCatalogResources: reverting =======================
main: -- remove_column(:catalog_resources, :state, :smallint, {:null=>false, :limit=>1, :default=>0})
main:    -> 0.0063s
main: == 20230630170515 AddStateToCatalogResources: reverted (0.0521s) ==============

main: == [advisory_lock_connection] object_id: 223300, pg_backend_pid: 69092
ci: == [advisory_lock_connection] object_id: 223240, pg_backend_pid: 69543
ci: == 20230630170515 AddStateToCatalogResources: reverting =======================
ci: -- remove_column(:catalog_resources, :state, :smallint, {:null=>false, :limit=>1, :default=>0})
ci:    -> 0.0022s
ci: == 20230630170515 AddStateToCatalogResources: reverted (0.1337s) ==============

ci: == [advisory_lock_connection] object_id: 223240, pg_backend_pid: 69543

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #415289 (closed)

Edited by Leaminn Ma

Merge request reports