Sha256: 5374454e6662249eddfd91ac68903fb41355439cbe2076669ff32f49237343df

Contents?: true

Size: 701 Bytes

Versions: 22

Compression:

Stored size: 701 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 -%>
<% unless separate_passwords? -%>
  String :password_hash
<% end -%>
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
plutonium-0.6.0 lib/generators/pu/rodauth/migration/sequel/base.erb
plutonium-0.5.0 lib/generators/pu/rodauth/migration/sequel/base.erb