Files
HKSingleParty/99_references/supabase-examples/enterprise-patterns/partitions/supabase/migrations/20000101003625_sales.sql
2025-05-28 09:55:51 +08:00

20 lines
492 B
SQL

create table sales (
id bigint generated by default as identity,
order_date date not null,
customer_id bigint,
amount bigint,
-- We need to include all the
-- partitioning columns in constraints:
primary key (order_date, id)
)
partition by range (order_date);
create table sales_2000_01
partition of sales
for values from ('2000-01-01') to ('2000-02-01');
create table sales_2000_02
partition of sales
for values from ('2000-02-01') to ('2000-03-01');