diff --git a/db/migrate/2020091309001_enable_pgcrypto_extension.rb b/db/migrate/2020091309001_enable_pgcrypto_extension.rb new file mode 100644 index 0000000..e5c01b9 --- /dev/null +++ b/db/migrate/2020091309001_enable_pgcrypto_extension.rb @@ -0,0 +1,5 @@ +class EnablePgcryptoExtension < ActiveRecord::Migration[5.0] + def change + enable_extension 'pgcrypto' + end +end \ No newline at end of file diff --git a/db/migrate/20200913091950_create_users.rb b/db/migrate/20200913091950_create_users.rb index d4053c2..05cf105 100644 --- a/db/migrate/20200913091950_create_users.rb +++ b/db/migrate/20200913091950_create_users.rb @@ -1,6 +1,6 @@ class CreateUsers < ActiveRecord::Migration[6.0] def change - create_table :users, id: :uuid do |t| + create_table :users, id: :uuid, default: -> { "gen_random_uuid()" } do |t| t.string :email t.string :password t.string :username diff --git a/db/migrate/20200913091956_create_weapons.rb b/db/migrate/20200913091956_create_weapons.rb index 8128ebe..0e055b0 100644 --- a/db/migrate/20200913091956_create_weapons.rb +++ b/db/migrate/20200913091956_create_weapons.rb @@ -1,6 +1,6 @@ class CreateWeapons < ActiveRecord::Migration[6.0] def change - create_table :weapons, id: :uuid do |t| + create_table :weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t| t.string :name_en t.string :name_jp t.integer :granblue_id diff --git a/db/migrate/20200913092001_create_parties.rb b/db/migrate/20200913092001_create_parties.rb index 95b2203..c2e23fb 100644 --- a/db/migrate/20200913092001_create_parties.rb +++ b/db/migrate/20200913092001_create_parties.rb @@ -1,7 +1,7 @@ class CreateParties < ActiveRecord::Migration[6.0] def change - create_table :parties, id: :uuid do |t| t.belongs_to :user, type: :uuid + create_table :parties, id: :uuid, default: -> { "gen_random_uuid()" } do |t| t.string :hash diff --git a/db/migrate/20200913092024_create_grid_weapons.rb b/db/migrate/20200913092024_create_grid_weapons.rb index 5f10538..7d4a572 100644 --- a/db/migrate/20200913092024_create_grid_weapons.rb +++ b/db/migrate/20200913092024_create_grid_weapons.rb @@ -1,8 +1,8 @@ class CreateGridWeapons < ActiveRecord::Migration[6.0] def change - create_table :grid_weapons do |t| t.belongs_to :composition, type: :uuid + create_table :grid_weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t| t.references :weapon, type: :uuid t.references :weapon_key1, class_name: 'WeaponKey', type: :uuid t.references :weapon_key2, class_name: 'WeaponKey', type: :uuid diff --git a/db/migrate/20200913092045_create_weapon_keys.rb b/db/migrate/20200913092045_create_weapon_keys.rb index 1f5ca02..6e5c7d0 100644 --- a/db/migrate/20200913092045_create_weapon_keys.rb +++ b/db/migrate/20200913092045_create_weapon_keys.rb @@ -1,6 +1,6 @@ class CreateWeaponKeys < ActiveRecord::Migration[6.0] def change - create_table :weapon_keys do |t| + create_table :weapon_keys, id: :uuid, default: -> { "gen_random_uuid()" } do |t| t.string :name_en t.string :name_jp