接通 Windows 与 Web 设备间加密文字聊天
This commit is contained in:
1 parent
b04034ee89
commit
d1efdedc57
27 files changed
+880
-22
No files matched your search
@@ -0,0 +1,5 @@
|
||||
CREATE TABLE device_mls_credentials (
|
||||
device_id uuid PRIMARY KEY REFERENCES devices(id) ON DELETE CASCADE,
|
||||
public_key bytea NOT NULL CHECK (octet_length(public_key)=32),
|
||||
signature bytea NOT NULL CHECK (octet_length(signature)=64)
|
||||
);
|
||||
@@ -19,6 +19,9 @@ var deliveryMigration string
|
||||
//go:embed 004_key_packages.sql
|
||||
var keyPackagesMigration string
|
||||
|
||||
//go:embed 005_mls_credentials.sql
|
||||
var mlsCredentialsMigration string
|
||||
|
||||
func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
|
||||
tx, err := pool.Begin(ctx)
|
||||
if err != nil {
|
||||
@@ -31,7 +34,7 @@ func Migrate(ctx context.Context, pool *pgxpool.Pool) error {
|
||||
if _, err = tx.Exec(ctx, "CREATE TABLE IF NOT EXISTS schema_migrations (version integer PRIMARY KEY)"); err != nil {
|
||||
return err
|
||||
}
|
||||
for index, migration := range []string{identityMigration, contactsMigration, deliveryMigration, keyPackagesMigration} {
|
||||
for index, migration := range []string{identityMigration, contactsMigration, deliveryMigration, keyPackagesMigration, mlsCredentialsMigration} {
|
||||
version := index + 1
|
||||
var applied bool
|
||||
if err = tx.QueryRow(ctx, "SELECT EXISTS (SELECT 1 FROM schema_migrations WHERE version=$1)", version).Scan(&applied); err != nil {
|
||||
|
||||
Reference in new issue
Block a user