Commit 1906aa9b authored by Marcia Ramos's avatar Marcia Ramos

Merge branch 'tc-framework-reg-table-docs' into 'master'

Correctly create registry table with text limits

See merge request gitlab-org/gitlab!35745
parents 94b8a0d7 67690bb7
......@@ -235,20 +235,32 @@ For example, to add support for files referenced by a `Widget` model with a
class CreateWidgetRegistry < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
create_table :widget_registry, id: :serial, force: :cascade do |t|
t.integer :widget_id, null: false
t.integer :state, default: 0, null: false
t.integer :retry_count, default: 0
t.string :last_sync_failure, limit: 255
t.datetime_with_timezone :retry_at
t.datetime_with_timezone :last_synced_at
t.datetime_with_timezone :created_at, null: false
t.index :widget_id, name: :index_widget_registry_on_repository_id, using: :btree
t.index :retry_at, name: :index_widget_registry_on_retry_at, using: :btree
t.index :state, name: :index_widget_registry_on_state, using: :btree
disable_ddl_transaction!
def up
unless table_exists?(:widget_registry)
ActiveRecord::Base.transaction do
create_table :widget_registry, id: :bigserial, force: :cascade do |t|
t.integer :widget_id, null: false
t.integer :state, default: 0, null: false, limit: 2
t.integer :retry_count, default: 0, limit: 2
t.text :last_sync_failure
t.datetime_with_timezone :retry_at
t.datetime_with_timezone :last_synced_at
t.datetime_with_timezone :created_at, null: false
t.index :widget_id
t.index :retry_at
t.index :state
end
end
end
add_text_limit :widget_registry, :last_sync_failure, 255
end
def down
drop_table :widget_registry
end
end
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment