Initial commit

This commit is contained in:
Yaser
2026-08-13 19:50:53 +03:30
commit 38084458fe
879 changed files with 95198 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# frozen_string_literal: true
class MakeUUIDNotNil < ActiveRecord::Migration[5.2]
def change
case ActiveRecord::Base.connection.adapter_name
when 'Mysql2'
execute('UPDATE orders SET uuid = (UNHEX(REPLACE(UUID(), "-",""))) WHERE uuid IS NULL')
change_column :orders, :uuid, :binary, limit: 16, index: { unique: true }, after: :id, null: false
when 'PostgreSQL'
enable_extension 'uuid-ossp'
enable_extension 'pgcrypto'
remove_column :orders, :uuid
add_column :orders, :uuid, :uuid, index: { unique: true }, after: :id, null: false, default: 'gen_random_uuid()'
else
raise "Unsupported adapter: #{ActiveRecord::Base.connection.adapter_name}"
end
end
end