v0.3.4-pre.002
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-store-postgres-lib/src/schema.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
/// Immutable V000 physical schema resource inventory.
|
||||
pub(crate) const V000_RESOURCES: &[SchemaResource] = &[SchemaResource {
|
||||
@@ -378,6 +378,55 @@ pub(crate) const V001_RESOURCES: &[SchemaResource] = &[
|
||||
sql: include_str!("../migrations/v001_raw_transaction/indexes/001_ix_ksp_raw_transactions_slot_signature.sql"),
|
||||
},
|
||||
];
|
||||
/// V002 physical schema resource inventory for the minimal RAW account state foundation.
|
||||
pub(crate) const V002_RESOURCES: &[SchemaResource] = &[
|
||||
SchemaResource {
|
||||
id: "tables/001_ksp_raw_account_states.sql",
|
||||
object: SchemaObjectContract::Table(TableContract {
|
||||
columns: RAW_ACCOUNT_STATES_COLUMNS,
|
||||
name: "ksp_raw_account_states",
|
||||
primary_key_columns: std::option::Option::None,
|
||||
}),
|
||||
repair_existing: true,
|
||||
sql: include_str!("../migrations/v002_raw_account_state/tables/001_ksp_raw_account_states.sql"),
|
||||
},
|
||||
SchemaResource {
|
||||
id: "tables/002_ksp_raw_account_observations.sql",
|
||||
object: SchemaObjectContract::Table(TableContract {
|
||||
columns: RAW_ACCOUNT_OBSERVATIONS_COLUMNS,
|
||||
name: "ksp_raw_account_observations",
|
||||
primary_key_columns: std::option::Option::None,
|
||||
}),
|
||||
repair_existing: true,
|
||||
sql: include_str!("../migrations/v002_raw_account_state/tables/002_ksp_raw_account_observations.sql"),
|
||||
},
|
||||
SchemaResource {
|
||||
id: "constraints/001_pk_ksp_raw_account_states.sql",
|
||||
object: SchemaObjectContract::Constraint(ConstraintContract { kind: "p", name: "pk_ksp_raw_account_states", table: "ksp_raw_account_states" }),
|
||||
repair_existing: true,
|
||||
sql: include_str!("../migrations/v002_raw_account_state/constraints/001_pk_ksp_raw_account_states.sql"),
|
||||
},
|
||||
SchemaResource {
|
||||
id: "constraints/002_pk_ksp_raw_account_observations.sql",
|
||||
object: SchemaObjectContract::Constraint(ConstraintContract {
|
||||
kind: "p",
|
||||
name: "pk_ksp_raw_account_observations",
|
||||
table: "ksp_raw_account_observations",
|
||||
}),
|
||||
repair_existing: true,
|
||||
sql: include_str!("../migrations/v002_raw_account_state/constraints/002_pk_ksp_raw_account_observations.sql"),
|
||||
},
|
||||
SchemaResource {
|
||||
id: "constraints/003_fk_ksp_raw_account_observations_state.sql",
|
||||
object: SchemaObjectContract::Constraint(ConstraintContract {
|
||||
kind: "f",
|
||||
name: "fk_ksp_raw_account_observations_state",
|
||||
table: "ksp_raw_account_observations",
|
||||
}),
|
||||
repair_existing: true,
|
||||
sql: include_str!("../migrations/v002_raw_account_state/constraints/003_fk_ksp_raw_account_observations_state.sql"),
|
||||
},
|
||||
];
|
||||
|
||||
const COLUMN_LOAD_SQL: &str = r#"SELECT column_name::TEXT, udt_name::TEXT, (is_nullable = 'YES') AS nullable, numeric_precision::INTEGER, numeric_scale::INTEGER, column_default::TEXT, is_identity::TEXT, is_generated::TEXT
|
||||
FROM information_schema.columns
|
||||
@@ -710,6 +759,199 @@ const RAW_TRANSACTION_OBSERVATIONS_COLUMNS: &[ColumnContract] = &[
|
||||
udt_name: "int8",
|
||||
},
|
||||
];
|
||||
const RAW_ACCOUNT_STATES_COLUMNS: &[ColumnContract] = &[
|
||||
ColumnContract {
|
||||
name: "pubkey",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "slot",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::Some(20),
|
||||
numeric_scale: std::option::Option::Some(0),
|
||||
udt_name: "numeric",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "state_hash",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "lamports",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::Some(20),
|
||||
numeric_scale: std::option::Option::Some(0),
|
||||
udt_name: "numeric",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "owner",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "executable",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bool",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "rent_epoch",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::Some(20),
|
||||
numeric_scale: std::option::Option::Some(0),
|
||||
udt_name: "numeric",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "data",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
];
|
||||
const RAW_ACCOUNT_OBSERVATIONS_COLUMNS: &[ColumnContract] = &[
|
||||
ColumnContract {
|
||||
name: "observation_key",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "account_pubkey",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "account_slot",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::Some(20),
|
||||
numeric_scale: std::option::Option::Some(0),
|
||||
udt_name: "numeric",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "account_state_hash",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "provider",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "protocol",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "acquisition_method",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "origin",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "received_at_unix_millis",
|
||||
nullable: false,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "int8",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "capture_session_id",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "commitment",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "endpoint_id",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "filter_id",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "text",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "observed_at_unix_millis",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "int8",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "source_payload_hash",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "source_payload_size_bytes",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "int8",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "is_startup",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bool",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "transaction_signature",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::None,
|
||||
numeric_scale: std::option::Option::None,
|
||||
udt_name: "bytea",
|
||||
},
|
||||
ColumnContract {
|
||||
name: "write_version",
|
||||
nullable: true,
|
||||
numeric_precision: std::option::Option::Some(20),
|
||||
numeric_scale: std::option::Option::Some(0),
|
||||
udt_name: "numeric",
|
||||
},
|
||||
];
|
||||
const RAW_TRANSACTION_ARCHIVE_PAYLOADS_COLUMNS: &[ColumnContract] = &[
|
||||
ColumnContract {
|
||||
name: "signature",
|
||||
|
||||
Reference in New Issue
Block a user