feat(qaops): 增加版本化部门区域归属配置与预览
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
DROP TABLE IF EXISTS qa_ops_organization_state;
|
||||
DROP TABLE IF EXISTS qa_ops_region_revisions;
|
||||
DROP TABLE IF EXISTS qa_ops_directory_snapshots;
|
||||
@@ -0,0 +1,26 @@
|
||||
CREATE TABLE qa_ops_directory_snapshots (
|
||||
tenant_key TEXT NOT NULL,
|
||||
id TEXT NOT NULL,
|
||||
source TEXT NOT NULL CHECK (source IN ('weekly_report_snapshot','weekly_report_live')),
|
||||
synced_at TIMESTAMPTZ NOT NULL,
|
||||
imported_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
payload JSONB NOT NULL CHECK (jsonb_typeof(payload)='object'),
|
||||
PRIMARY KEY (tenant_key,id)
|
||||
);
|
||||
CREATE TABLE qa_ops_region_revisions (
|
||||
tenant_key TEXT NOT NULL,
|
||||
id TEXT NOT NULL,
|
||||
directory_id TEXT NOT NULL,
|
||||
rules JSONB NOT NULL CHECK (jsonb_typeof(rules)='array'),
|
||||
updated_by TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (tenant_key,id),
|
||||
FOREIGN KEY (tenant_key,directory_id) REFERENCES qa_ops_directory_snapshots(tenant_key,id)
|
||||
);
|
||||
CREATE TABLE qa_ops_organization_state (
|
||||
tenant_key TEXT PRIMARY KEY,
|
||||
directory_id TEXT NOT NULL,
|
||||
revision_id TEXT,
|
||||
FOREIGN KEY (tenant_key,directory_id) REFERENCES qa_ops_directory_snapshots(tenant_key,id),
|
||||
FOREIGN KEY (tenant_key,revision_id) REFERENCES qa_ops_region_revisions(tenant_key,id)
|
||||
);
|
||||
@@ -11,8 +11,8 @@ func TestEmbeddedMigrationsAreVersionSorted(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("loadMigrations() error = %v", err)
|
||||
}
|
||||
if len(migrations) != 47 {
|
||||
t.Fatalf("migration count = %d, want 47", len(migrations))
|
||||
if len(migrations) != 48 {
|
||||
t.Fatalf("migration count = %d, want 48", len(migrations))
|
||||
}
|
||||
if migrations[0].Version != 1 || !strings.Contains(migrations[0].UpSQL, "CREATE TABLE IF NOT EXISTS jobs") {
|
||||
t.Fatalf("migration 1 = %#v", migrations[0])
|
||||
|
||||
Reference in New Issue
Block a user