feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s

This commit is contained in:
Anya Tokugawa committed 2026-11-15 05:47:14 +09:00
1 parent 96065d1e89
commit 0ba1dcfef0
243 files changed
+21441 -3090

No files matched your search

+23 -8
View File
@@ -1,8 +1,15 @@
package store
import "database/sql"
import (
"context"
"database/sql"
"time"
)
func (s *Store) EnsureConfigTable() error {
if s.sqlBackend == storePostgreSQL {
return s.ensurePostgreSQLNamespaces(context.Background())
}
if _, err := s.DB.Exec(`CREATE TABLE IF NOT EXISTS personal_appearance (
domain_uuid TEXT NOT NULL, owner_uuid TEXT NOT NULL, version INTEGER NOT NULL,
data TEXT NOT NULL, PRIMARY KEY(domain_uuid,owner_uuid))`); err != nil {
@@ -98,15 +105,19 @@ func (s *Store) GetConfig(key string) (string, error) {
}
func (s *Store) GetConfigInDomain(domainUUID, key string) (string, error) {
return s.GetConfigInDomainContext(context.Background(), domainUUID, key)
}
func (s *Store) GetConfigInDomainContext(ctx context.Context, domainUUID, key string) (string, error) {
var value string
err := s.DB.QueryRow(`
err := s.DB.QueryRowContext(ctx, `
SELECT value FROM config
WHERE domain_uuid = ? AND key = ?
WHERE domain_uuid = `+s.sqlParam(1)+` AND key = `+s.sqlParam(2)+`
`, domainUUID, key).Scan(&value)
if err == sql.ErrNoRows {
return "", nil
}
return value, err
return value, s.sqlError("read configuration", err)
}
func (s *Store) SetConfig(key, value string) error {
@@ -118,13 +129,17 @@ func (s *Store) SetConfig(key, value string) error {
}
func (s *Store) SetConfigInDomain(domainUUID, key, value string) error {
_, err := s.DB.Exec(`
return s.SetConfigInDomainContext(context.Background(), domainUUID, key, value)
}
func (s *Store) SetConfigInDomainContext(ctx context.Context, domainUUID, key, value string) error {
_, err := s.DB.ExecContext(ctx, `
INSERT INTO config (domain_uuid, key, value, updated_at)
VALUES (?, ?, ?, strftime('%s','now'))
VALUES (`+s.sqlValues(4)+`)
ON CONFLICT(domain_uuid, key)
DO UPDATE SET
value = excluded.value,
updated_at = excluded.updated_at
`, domainUUID, key, value)
return err
`, domainUUID, key, value, time.Now().Unix())
return s.sqlError("write configuration", err)
}