33 lines
1.1 KiB
Ruby
33 lines
1.1 KiB
Ruby
class CreatePostFileThumbnailsFingerprints < ActiveRecord::Migration[7.2]
|
|
def change
|
|
up_only { execute "SET DEFAULT_TABLESPACE = mirai;" }
|
|
|
|
create_table :domain_post_file_thumbnails do |t|
|
|
t.references :post_file, null: false, index: false
|
|
t.integer :thumb_type, null: false
|
|
t.integer :frame, null: false, default: 0
|
|
t.timestamps
|
|
|
|
t.index %i[post_file_id thumb_type frame], unique: true
|
|
end
|
|
|
|
create_table :domain_post_file_bit_fingerprints do |t|
|
|
t.references :post_file, null: false, index: false
|
|
t.references :thumbnail, null: false, index: false
|
|
t.bit :fingerprint_value, limit: 256
|
|
t.bit :fingerprint_detail_value, limit: 1024
|
|
t.timestamps
|
|
|
|
t.index %i[post_file_id thumbnail_id], unique: true
|
|
end
|
|
|
|
# create_table :domain_post_file_vector_fingerprints do |t|
|
|
# t.integer :type, null: false
|
|
# t.references :thumbnail, null: false, index: true
|
|
# t.vector :fingerprint_value, limit: 256
|
|
# t.timestamps
|
|
# t.index :fingerprint_value, using: :hnsw, opclass: :vector_cosine_ops
|
|
# end
|
|
end
|
|
end
|