Add column AsymmetricKey#curve
This commit is contained in:
parent
d779cea747
commit
d47a8bba61
2 changed files with 8 additions and 1 deletions
|
@ -22,6 +22,7 @@ class CreateX509Tables < ActiveRecord::Migration[6.0]
|
||||||
t.string :sha256, null: false
|
t.string :sha256, null: false
|
||||||
|
|
||||||
t.integer :bits
|
t.integer :bits
|
||||||
|
t.string :curve
|
||||||
|
|
||||||
t.index :public_key_pem, unique: true
|
t.index :public_key_pem, unique: true
|
||||||
t.index :public_key_der, unique: true
|
t.index :public_key_der, unique: true
|
||||||
|
@ -33,6 +34,10 @@ class CreateX509Tables < ActiveRecord::Migration[6.0]
|
||||||
bits IS NULL OR bits in (2048, 4096)
|
bits IS NULL OR bits in (2048, 4096)
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
constraint :asymmetric_keys, :curve, <<~SQL
|
||||||
|
curve IS NULL OR curve in ('prime256v1', 'secp384r1')
|
||||||
|
SQL
|
||||||
|
|
||||||
create_table :x509_certificates do |t|
|
create_table :x509_certificates do |t|
|
||||||
t.timestamps null: false
|
t.timestamps null: false
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,9 @@ CREATE TABLE public.asymmetric_keys (
|
||||||
sha1 character varying NOT NULL,
|
sha1 character varying NOT NULL,
|
||||||
sha256 character varying NOT NULL,
|
sha256 character varying NOT NULL,
|
||||||
bits integer,
|
bits integer,
|
||||||
CONSTRAINT bits CHECK (((bits IS NULL) OR (bits = ANY (ARRAY[2048, 4096]))))
|
curve character varying,
|
||||||
|
CONSTRAINT bits CHECK (((bits IS NULL) OR (bits = ANY (ARRAY[2048, 4096])))),
|
||||||
|
CONSTRAINT curve CHECK (((curve IS NULL) OR ((curve)::text = ANY ((ARRAY['prime256v1'::character varying, 'secp384r1'::character varying])::text[]))))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue