module Slosilo::Adapters::SequelAdapter::Migration

Constants

DEFAULT_KEYSTORE_TABLE

The default name of the table to hold the keys

Attributes

keystore_table[RW]

Keystore table name. If changing this do it immediately after loading the extension.

Public Class Methods

extended(db) click to toggle source

Sets up default keystore table name

# File lib/slosilo/adapters/sequel_adapter/migration.rb, line 9
def self.extended(db)
  db.keystore_table ||= DEFAULT_KEYSTORE_TABLE
end

Public Instance Methods

create_keystore_table() click to toggle source

Create the table for holding keys

# File lib/slosilo/adapters/sequel_adapter/migration.rb, line 17
def create_keystore_table
  # docs say to not use create_table? in migration;
  # but we really want this to be robust in case there are any previous installs
  # and we can't use table_exists? because it rolls back
  create_table? keystore_table do
    String :id, primary_key: true
    bytea :key, null: false
    String :fingerprint, unique: true, null: false
  end
end
drop_keystore_table() click to toggle source

Drop the table

# File lib/slosilo/adapters/sequel_adapter/migration.rb, line 29
def drop_keystore_table
  drop_table keystore_table
end