Sha256: 61e265c58b193c8f406b7b57986fb9af87852891c3fb00c136bb33069ad9ee25

Contents?: true

Size: 656 Bytes

Versions: 10

Compression:

Stored size: 656 Bytes

Contents

<% if db.database_type == :postgres -%>
begin
  run "CREATE EXTENSION IF NOT EXISTS citext"
rescue NoMethodError # migration is being reverted
end

<% end -%>
create_table :<%= table_prefix.pluralize %> do
  primary_key :id, type: :Bignum
<% if db.database_type == :postgres -%>
  citext :email, null: false
  constraint :valid_email, email: /^[^,;@ \r\n]+@[^,@; \r\n]+\.[^,@; \r\n]+$/
<% else -%>
  String :email, null: false
<% end -%>
  Integer :status, null: false, default: 1
<% if db.supports_partial_indexes? -%>
  index :email, unique: true, where: { status: [1, 2] }
<% else -%>
  index :email, unique: true
<% end -%>
  String :password_hash
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rodauth-rails-1.15.2 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.15.1 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.15.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.14.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.13.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.12.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.11.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.10.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.9.0 lib/generators/rodauth/migration/sequel/base.erb
rodauth-rails-1.8.0 lib/generators/rodauth/migration/sequel/base.erb