diff --git a/db/flags.sql b/db/flags.sql index b54bc595..4f2ef406 100644 --- a/db/flags.sql +++ b/db/flags.sql @@ -11,4 +11,4 @@ CREATE TABLE IF NOT EXISTS flags.kvdata ( CONSTRAINT unique_kvdata_timeseries_obstime UNIQUE (timeseries, obstime) ); CREATE INDEX IF NOT EXISTS kvdata_obstime_index ON flags.kvdata (obstime); -CREATE INDEX IF NOT EXISTS kvdata_timeseries_index ON flags.kvdata USING HASH (timeseries); +CREATE INDEX IF NOT EXISTS kvdata_timeseries_index ON flags.kvdata USING HASH (timeseries); diff --git a/integration_tests/src/main.rs b/integration_tests/src/main.rs index a73a1241..36eece8e 100644 --- a/integration_tests/src/main.rs +++ b/integration_tests/src/main.rs @@ -9,22 +9,6 @@ async fn insert_schema(client: &tokio_postgres::Client, filename: &str) -> Resul client.batch_execute(schema.as_str()).await } -fn format_partition(start: &str, end: &str, table: &str) -> String { - // TODO: add multiple partitions? - format!( - "CREATE TABLE {table}_y{start}_to_y{end} PARTITION OF {table} \ - FOR VALUES FROM ('{start}-01-01 00:00:00+00') TO ('{end}-01-01 00:00:00+00')", - ) -} - -async fn create_data_partitions(client: &tokio_postgres::Client) -> Result<(), Error> { - let scalar_string = format_partition("1950", "2100", "public.data"); - let nonscalar_string = format_partition("1950", "2100", "public.nonscalar_data"); - - client.batch_execute(scalar_string.as_str()).await?; - client.batch_execute(nonscalar_string.as_str()).await -} - #[tokio::main] async fn main() { let (client, connection) = tokio_postgres::connect(CONNECT_STRING, NoTls) @@ -38,10 +22,13 @@ async fn main() { }); // NOTE: order matters - let schemas = ["db/public.sql", "db/labels.sql", "db/flags.sql"]; + let schemas = [ + "db/public.sql", + "db/partitions_generated.sql", + "db/labels.sql", + "db/flags.sql", + ]; for schema in schemas { insert_schema(&client, schema).await.unwrap(); } - - create_data_partitions(&client).await.unwrap(); }