Add models to represent "Collections" (#36977)

This commit is contained in:
David Roetzel authored and GitHub committed 2025-11-21 10:28:23 +00:00
1 parent cfa4f402ef
commit 7ffa5fa0c4
12 files changed
+291 -1

No files matched your search

@@ -0,0 +1,19 @@
# frozen_string_literal: true
class CreateCollections < ActiveRecord::Migration[8.0]
def change
create_table :collections do |t|
t.references :account, null: false, foreign_key: true
t.string :name, null: false
t.text :description, null: false
t.string :uri
t.boolean :local, null: false # rubocop:disable Rails/ThreeStateBooleanColumn
t.boolean :sensitive, null: false # rubocop:disable Rails/ThreeStateBooleanColumn
t.boolean :discoverable, null: false # rubocop:disable Rails/ThreeStateBooleanColumn
t.references :tag, foreign_key: true
t.integer :original_number_of_items
t.timestamps
end
end
end
@@ -0,0 +1,18 @@
# frozen_string_literal: true
class CreateCollectionItems < ActiveRecord::Migration[8.0]
def change
create_table :collection_items do |t|
t.references :collection, null: false, foreign_key: { on_delete: :cascade }
t.references :account, foreign_key: true
t.integer :position, null: false, default: 1
t.string :object_uri, index: { unique: true, where: 'activity_uri IS NOT NULL' }
t.string :approval_uri, index: { unique: true, where: 'approval_uri IS NOT NULL' }
t.string :activity_uri
t.datetime :approval_last_verified_at
t.integer :state, null: false, default: 0
t.timestamps
end
end
end