1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/db/migrate/20190911081459_create_x509_tables.rb

43 lines
1.1 KiB
Ruby
Raw Normal View History

2019-09-11 04:17:24 -04:00
# frozen_string_literal: true
class CreateX509Tables < ActiveRecord::Migration[6.0]
include Partynest::Migration
def change
2019-09-13 13:14:28 -04:00
create_table :rsa_keys do |t|
2019-09-11 04:17:24 -04:00
t.timestamps null: false
2019-09-13 08:52:03 -04:00
t.text :public_key_pem, null: false
t.binary :public_key_der, null: false
2019-09-11 04:17:24 -04:00
t.binary :private_key_pem_iv
t.binary :private_key_pem_ciphertext
2019-09-12 01:00:50 -04:00
t.integer :bits, null: false
t.string :sha1, null: false
t.string :sha256, null: false
t.index :public_key_pem, unique: true
2019-09-13 08:52:03 -04:00
t.index :public_key_der, unique: true
2019-09-12 01:00:50 -04:00
t.index :sha1, unique: true
t.index :sha256, unique: true
2019-09-11 04:17:24 -04:00
end
2019-09-13 13:14:28 -04:00
constraint :rsa_keys, :bits, <<~SQL
2019-09-11 04:17:24 -04:00
bits in (2048, 4096)
SQL
create_table :x509_certificates do |t|
t.timestamps null: false
2019-09-13 13:14:28 -04:00
t.references :rsa_key, null: false, foreign_key: true
2019-09-11 04:17:24 -04:00
t.text :pem, null: false
t.string :subject, null: false
t.string :issuer, null: false
t.datetime :not_before, null: false
t.datetime :not_after, null: false
2019-09-11 04:17:24 -04:00
end
end
end