Sha256: 058efd4e561ac00e5e2c4b73ec9acc50f4ea28c891905e0501be6ab5e3f4c8e4

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

<% if activerecord_adapter == "postgresql" -%>
enable_extension "citext"

<% end -%>
create_table :accounts<%= primary_key_type %> do |t|
<% case activerecord_adapter -%>
<% when "postgresql" -%>
  t.citext :email, null: false
<% else -%>
  t.string :email, null: false
<% end -%>
  t.integer :status, null: false, default: 1
<% case activerecord_adapter -%>
<% when "postgresql", "sqlite3" -%>
  t.index :email, unique: true, where: "status IN (1, 2)"
<% else -%>
  t.index :email, unique: true
<% end -%>
end

# Used if storing password hashes in a separate table (default)
create_table :account_password_hashes<%= primary_key_type %> do |t|
  t.foreign_key :accounts, column: :id
  t.string :password_hash, null: false
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rodauth-rails-1.2.2 lib/generators/rodauth/migration/base.erb
rodauth-rails-1.2.1 lib/generators/rodauth/migration/base.erb